flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

TS: segfault/crash with --gen-object-api for array of enums

Open jtbandes opened this issue 1 year ago • 6 comments

The following schema triggers a segmentation fault:

enum Color : byte { Red = 1, Green, Blue }

struct MyStruct {
  xyz:[Color:1];
}
$ flatc --version
flatc version 24.3.25
$ flatc --ts --ts-no-import-ext --gen-object-api -o gen *.fbs
zsh: segmentation fault  flatc --ts --ts-no-import-ext --gen-object-api -o gen *.fbs

This seems to occur because 0 is not a valid value for Color. If you change Red = 1, to Red = 0, or just Red, then the crash no longer occurs.

If you remove the --gen-object-api the crash no longer occurs.

jtbandes avatar May 17 '24 20:05 jtbandes

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

github-actions[bot] avatar Nov 15 '24 20:11 github-actions[bot]

Probably still relevant

jtbandes avatar Nov 15 '24 21:11 jtbandes

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

github-actions[bot] avatar May 17 '25 20:05 github-actions[bot]

Probably still relevant

jtbandes avatar May 17 '25 20:05 jtbandes

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

github-actions[bot] avatar Nov 16 '25 20:11 github-actions[bot]

Probably still relevant

jtbandes avatar Nov 16 '25 21:11 jtbandes

@bjornharrtell (hope you don't mind me tagging you on so many issues :D )

jtdavis777 avatar Dec 06 '25 05:12 jtdavis777

@jtdavis777 that's ok :)

As for --gen-object-api I have little interest in it but I agree this would be good to fix.

bjornharrtell avatar Dec 06 '25 09:12 bjornharrtell