View Issue Details

IDProjectCategoryView StatusLast Update
0001085Ecere SDKecerepublic2014-08-08 18:17
Reporterredj Assigned Tojerome  
PriorityimmediateSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Platformx86_64:windowsOS-OS Version-
Product Version0.44.09 
Target Version0.44.10 64Fixed in Version0.44.10 64 
Summary0001085: JSON Map containers Read/Write Support
Description2 cases where json parser will crash on null in a map
use
#define CASE1
and
#define CASE2
Steps To Reproduce#define CASE1
//#define CASE2

import "ecere"

class TestClass
{
public:
   Map<String, NoHead> m;
}

class NoHead : struct
{
public:
   bool a;
   bool b;
}

class Form1 : Window
{
   hasClose = true;
   clientSize = { 632, 438 };

   Button button1
   {
      this, caption = $"button1", position = { 264, 184 };

      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
      {
         File f = FileOpen("test.json", write);
         if(f)
         {
            Map<String, NoHead> m { };
            TestClass c { m = m };
#ifdef CASE1
            m["k1"] = NoHead { a = true };
            m["k2"] = null;
            m["k0"] = NoHead { };
#endif
#ifdef CASE2
            m["k2"] = null;
#endif
            PrintLn(c.m);
            WriteJSONObject(f, class(TestClass), c, 0);
            delete c;
            delete f;
         }

         f = FileOpen("test.json", read);
         if(f)
         {
            TestClass c = null;
            JSONParser parser { f = f };
            /*JSONResult result = */parser.GetObject(class(TestClass), &c);
            if(c)
               PrintLn(c.m);
         }
         return true;
      }
   };
}

Form1 form1 {};
TagsNo tags attached.

Issue History

Date Modified Username Field Change
2014-06-18 02:14 redj New Issue
2014-06-18 02:14 redj Status new => assigned
2014-06-18 02:14 redj Assigned To => jerome
2014-06-19 05:19 jerome Summary json parser crash on null entries in a Map of no head class with string key => JSON Map containers Read/Write Support
2014-06-19 05:29 jerome Status assigned => resolved
2014-06-19 05:29 jerome Fixed in Version => 0.44.10 64
2014-06-19 05:29 jerome Resolution open => fixed
2014-06-19 05:29 jerome Note Added: 0001344
2014-08-08 18:17 jerome Status resolved => closed