Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008768opensim[REGION] Script Functionspublic2020-09-07 17:092020-09-07 19:29
ReporterKristen Mynx 
Assigned ToKristen Mynx 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version0.9.1.0 
Target VersionFixed in Version 
Summary0008768: 0.9.1.* and 0.9.2.0 llList2Json() fails when passed an empty string value
DescriptionllList2Json returns JSON_INVALID when any value of the list passed in is an empty string. It occurs on JSON_OBJECT or JSON_ARRAY.

I've attached a patch to fix the problem. (JsonEmptyString.patch)

It is caused by referencing the first character of a string without first checking if there are any characters in the string. This throws an exception, which the upper level code translates into JSON_INVALID.

Steps To ReproduceRez a box
New Script
Copy/Paste in the script in Additional Information
Result will be:
[17:00] json test: ?
Result Should be:
[17:00] json test: {"NameWithEmptyValue":""}

Additional Informationlist jsonin = [
"NameWithEmptyValue", ""
];

default
{
    state_entry()
    {
        string json = llList2Json(JSON_OBJECT, jsonin);
        llOwnerSay(json);
    }
}
TagsNo tags attached.
Git Revision or version number
Run ModeStandalone (1 Region) , Standalone (Multiple Regions) , Grid (1 Region per Sim) , Grid (Multiple Regions per Sim)
Physics EngineBasicPhysics, ODE, BulletSim, ubODE, Other
Script EngineXEngine, YEngine
EnvironmentMono / Linux32, Mono / Linux64, Mono / Windows, Mono / OSX, .NET / Windows32, .NET / Windows64
Mono VersionNone
Viewer
Attached Filespatch file icon JsonEmptyString.patch [^] (843 bytes) 2020-09-07 17:09 [Show Content]

- Relationships

-  Notes
(0036803)
UbitUmarov (administrator)
2020-09-07 17:32

thanks, should be better now
for some reason your patch failed automatic apply,
but easy done by hand and a bit different
(0036806)
Kristen Mynx (reporter)
2020-09-07 19:29

Works as of b9c68b 2020-09-08 00:29:22

- Issue History
Date Modified Username Field Change
2020-09-07 17:09 Kristen Mynx New Issue
2020-09-07 17:09 Kristen Mynx File Added: JsonEmptyString.patch
2020-09-07 17:32 UbitUmarov Note Added: 0036803
2020-09-07 19:29 Kristen Mynx Note Added: 0036806
2020-09-07 19:29 Kristen Mynx Status new => resolved
2020-09-07 19:29 Kristen Mynx Resolution open => fixed
2020-09-07 19:29 Kristen Mynx Assigned To => Kristen Mynx


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker