Skip to content

Buffer overflow in json_acis_data detected on Fedora #1183

@neilberkman

Description

@neilberkman

Buffer overflow detected when processing JSON files with ACIS data arrays.

Error

Reading JSON file example_r14.json
*** buffer overflow detected ***: terminated

Location

src/in_json.c function json_acis_data - incorrect buffer allocation calculation.

Details

The function allocates based on JSON array token size (t->end - t->start) rather than the actual combined string content size, causing overflow when concatenating strings.

Reproduction

Build on Fedora with default flags (includes -D_FORTIFY_SOURCE=2) and run:

dwgread -o example_r14.json test/test-data/example_r14.dwg
dwgwrite -o test.dwg example_r14.json

Evidence

CI failure: https://github.com/neilberkman/libredwg/actions/runs/17504170044/job/49724000228#step:10:170

Discovered while implementing multi-platform CI (#1181).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions