http://d.puremagic.com/issues/show_bug.cgi?id=4089
Summary: crash when creating JSON output for incomplete struct
Product: D
Version: unspecified
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: ice-on-valid-code, patch
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Rainer Schuetze <[email protected]> 2010-04-14 00:01:04
PDT ---
This one-line code:
/// test.d
struct X;
causes a crash when executing
dmd -c -X test.d
Here's a patch
Index: json.c
===================================================================
--- json.c (revision 432)
+++ json.c (working copy)
@@ -307,16 +307,19 @@
}
}
- JsonString(buf, Pmembers);
- buf->writestring(" : [\n");
- size_t offset = buf->offset;
- for (int i = 0; i < members->dim; i++)
- { Dsymbol *s = (Dsymbol *)members->data[i];
- if (offset != buf->offset)
- { buf->writestring(",\n");
- offset = buf->offset;
+ if(members)
+ {
+ JsonString(buf, Pmembers);
+ buf->writestring(" : [\n");
+ size_t offset = buf->offset;
+ for (int i = 0; i < members->dim; i++)
+ { Dsymbol *s = (Dsymbol *)members->data[i];
+ if (offset != buf->offset)
+ { buf->writestring(",\n");
+ offset = buf->offset;
+ }
+ s->toJsonBuffer(buf);
}
- s->toJsonBuffer(buf);
}
JsonRemoveComma(buf);
buf->writestring("]\n");
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------