Bug 338970 - JSON.parse corrupted
Summary: JSON.parse corrupted
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: 4.13.3
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL: http://bugs.idsl.pl/konqueror/JSON.pa...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-10 10:13 UTC by bugzilla77
Modified: 2014-10-10 11:10 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.14.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugzilla77 2014-09-10 10:13:12 UTC
JSON.parse method do not decode unicode \u characters < 32.

Reproducible: Always

Steps to Reproduce:
<script type="text/javascript">
 document.write(JSON.parse('"\\u0000"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0001"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0002"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0003"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0004"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0005"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0006"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0007"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0008"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0009"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u000a"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u000b"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u000c"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u000d"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u000e"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u000f"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0010"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0011"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0012"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0013"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0014"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0015"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0016"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0017"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0018"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u0019"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u001a"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u001b"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u001c"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u001d"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u001e"').charCodeAt()+'<br/>')
 document.write(JSON.parse('"\\u001f"').charCodeAt()+'<br/>')
</script>

Actual Results:  
[empty screen]

Expected Results:  
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Firefox, Chrome, Opera, Explorer show numbers
Comment 1 Bernd Buschinski 2014-09-10 12:56:51 UTC
Hm, yes looks like I misinterpreted the invalid characters part.
U+0000 through U+001F is not allowed as char, but as escaped unicode sequence (ES5.1 15.12.1.1)
Comment 2 Bernd Buschinski 2014-09-18 16:17:32 UTC
Git commit 0f0db01274fab4e4cfec1485776fbdf10065b5d7 by Bernd Buschinski.
Committed on 10/09/2014 at 17:12.
Pushed by buschinski into branch 'KDE/4.14'.

kjs: U+0000 through U+001F is not allowed as char, but as escaped unicode sequence

M  +0    -5    kjs/jsonlexer.cpp

http://commits.kde.org/kdelibs/0f0db01274fab4e4cfec1485776fbdf10065b5d7
Comment 3 Bernd Buschinski 2014-09-18 16:17:41 UTC
Git commit 8d3db9eae95202906218239246aec324199b3c9d by Bernd Buschinski.
Committed on 10/09/2014 at 17:14.
Pushed by buschinski into branch 'master'.

U+0000 through U+001F is not allowed as char, but as escaped unicode sequence

M  +0    -4    src/kjs/jsonlexer.cpp

http://commits.kde.org/kjs/8d3db9eae95202906218239246aec324199b3c9d