Skip to content

fix GetColumnNames() undefined behavior on empty label row#214

Merged
d99kris merged 1 commit intod99kris:dev/integrate-getcolumnnames-empty-label-rowfrom
MarkLee131:fix/getcolumnnames-empty-label-row
Apr 12, 2026
Merged

fix GetColumnNames() undefined behavior on empty label row#214
d99kris merged 1 commit intod99kris:dev/integrate-getcolumnnames-empty-label-rowfrom
MarkLee131:fix/getcolumnnames-empty-label-row

Conversation

@MarkLee131
Copy link
Copy Markdown
Contributor

Fix #213:
GetColumnNames() did .begin() + (mRowNameIdx + 1) on the label row without checking that the row has enough elements. When the label row is empty (e.g. after InsertRow on an empty document with LabelParams(0,0)), .begin() wraps a null pointer and adding to it is undefined behavior.

Add a bounds check before the iterator arithmetic so it returns an empty vector instead of hitting UB.

GetColumnNames() did .begin() + (mRowNameIdx + 1) on the label row
without checking that the row has enough elements. When the label row
is empty (e.g. after InsertRow on an empty document with LabelParams(0,0)),
.begin() wraps a null pointer and adding to it is undefined behavior.

Add a bounds check before the iterator arithmetic so it returns an
empty vector instead of hitting UB.
@d99kris d99kris self-assigned this Apr 7, 2026
@d99kris
Copy link
Copy Markdown
Owner

d99kris commented Apr 12, 2026

Thanks for contributing! Generally the patch looks good. I'll merge your fix into an integration branch and make some minor adjustments there.

@d99kris d99kris changed the base branch from master to dev/integrate-getcolumnnames-empty-label-row April 12, 2026 04:36
@d99kris d99kris merged commit de6533b into d99kris:dev/integrate-getcolumnnames-empty-label-row Apr 12, 2026
3 checks passed
@d99kris
Copy link
Copy Markdown
Owner

d99kris commented Apr 12, 2026

This fix has been integrated to master in ab199f5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetColumnNames() null pointer arithmetic (UB)

2 participants