Review Request: kjs: Implement JSON.parse
Bernd Buschinski
b.buschinski at googlemail.com
Wed Jul 4 23:27:23 BST 2012
> On July 4, 2012, 2:24 p.m., Maks Orlovich wrote:
> > kjs/jsonlexer.cpp, line 198
> > <http://git.reviewboard.kde.org/r/105056/diff/4/?file=69807#file69807line198>
> >
> > I don't think this is needed anymore.
If we got called from JSONArray-TokLBrace we did not create an object.
In more detail for the following JSON String "[{}]"
If are in parse with type=JSONArray and state=TokLBrace,
means we just found the { in the Array, and call parse(exec, JSONObject),
now in this call type=JSONObject, state=TokRBrace ("}") and, our new, object=0 (!)
We will finish the object and return it, but as object is null, we return 0.
which would be wrong, as empty objects are allowed.
In this case we just report invalid data.
But for JSON String like "[{"a":1}]", we end up using object(0)->putDirect
and crash.
In short, remove this line and we will crash.
- Bernd
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/105056/#review15374
-----------------------------------------------------------
On June 18, 2012, 10:25 p.m., Bernd Buschinski wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/105056/
> -----------------------------------------------------------
>
> (Updated June 18, 2012, 10:25 p.m.)
>
>
> Review request for kdelibs.
>
>
> Description
> -------
>
> kjs: Implement JSON.parse
>
>
> Diffs
> -----
>
> kjs/CMakeLists.txt 1188064
> kjs/interpreter.cpp cf1acf1
> kjs/json_object.h PRE-CREATION
> kjs/json_object.cpp PRE-CREATION
> kjs/jsonlexer.h PRE-CREATION
> kjs/jsonlexer.cpp PRE-CREATION
> kjs/libkjs.map e9f679f
>
> Diff: http://git.reviewboard.kde.org/r/105056/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Bernd Buschinski
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120704/c8253909/attachment.htm>
More information about the kde-core-devel
mailing list