Significant JSON::Stringify, Uint8Array, or ArrayBuffer changes between v5.4 to v6.0.186

250 views
Skip to first unread message

muscovy

unread,
Jun 23, 2017, 6:35:09 PM6/23/17
to v8-users
I have a custom buffer-like object whose contents are handed by an ArrayBuffer:

    Local<ArrayBuffer> buf = obj.As<Uint8Array>()->Buffer();
    *data = static_cast<char *>(buf->GetContents().Data());

I also have a js file that uses it, with lines like:

String(data.length)
JSON.stringify(data)

This is called over a few hundred objects.

After upgrading from v8 version 5.4ish to 6.0.186, it seems that for a handful of objects, obj.length is 1-2 smaller than before, and the output of JSON.stringify(obj) is also shorter by that amount (the missing bytes come from anywhere in the buffer). 

Based on what's happening, I think some change in Uint8Array, ArrayBuffer, or possibly JSON::Stringify could be related, but I haven't had any luck so far trying to figure it out. Anyone able to point me in the right direction? Thanks in advance!

Zac Hansen

unread,
Jun 23, 2017, 8:15:01 PM6/23/17
to v8-users
can you provide some examples of outputs that have changed?

muscovy

unread,
Jun 26, 2017, 12:44:25 PM6/26/17
to v8-users
In UTF-8, calling JSON.stringify() on the buffer contents:

Old version: \\�����u�\"~JM@\u0015'7�`��\u001a]G�MA�\u001fJ�.� 
New version: \\���u�\"~JM@\u0015'7�`��\u001a]G�MA�\u001fJ�.�

However, in both versions, calling String(x) on each array element produces the same output:

[0]:92
[1]:137
[2]:242
[3]:152
[4]:138
[5]:251
[6]:117
[7]:216
[8]:34
[9]:126
[10]:74
[11]:77
[12]:64
[13]:21
[14]:39
[15]:55
[16]:165
[17]:96
[18]:135
[19]:197
[20]:26
[21]:93
[22]:71
[23]:134
[24]:77
[25]:65
[26]:230
[27]:31
[28]:74
[29]:184
[30]:46
[31]:141

Jakob Gruber

unread,
Jun 27, 2017, 3:39:44 AM6/27/17
to v8-u...@googlegroups.com
Interesting. It'd be very helpful if you could open a bug at crbug.com/v8/new with a full code example (including build instructions if it includes C++) and instructions to reproduce the issue. Feel free to assign it to me (jgr...@chromium.org) and I'll have a look.

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

muscovy

unread,
Jun 27, 2017, 4:35:30 PM6/27/17
to v8-users
Thanks Jakob. Sorry, I'm not sure how to assign issues, but here's the link: https://bugs.chromium.org/p/v8/issues/detail?id=6533
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages