fpJSONDataSet -- SIGSEGV when checking if field is null
Original Reporter info from Mantis: zoran
-
Reporter name: Zoran Vučenović
Original Reporter info from Mantis: zoran
- Reporter name: Zoran Vučenović
Description:
With fpJSONDataset, when you call IsNull method, for example JSONDataset1.Fields[0].IsNull, then:
- If the field is filled with regular value (not null), then, instead of returning False, the program crashes with Access violation.
- otherwise (when the field actually contains null), then the True value is returned regularly.
Steps to reproduce:
I'm attaching the test - a simple terminal program, but created as Lazarus project. See the comments in code.
Additional information:
I tracked down the bug to TBaseJSONDataSet.GetFieldData method.
IsNull calls this method with nil buffer, and when buffer parameter is nil, the GetFieldData should return without trying to fill the buffer with data, but TBaseJSONDataSet tries to write to the buffer, without checking if it is nil.
So, I created the patch which solves this.
The patch is attached -- fpjsondataset.diff.
Mantis conversion info:
- Mantis ID: 34348
- Build: 39830
- Version: 3.2.0
- Fixed in version: 3.3.1
- Fixed in revision: 39841 (#e6574526)
- Target version: 3.2.0