Skip to content

umber.h: Don't set string size in umber_class_new params#16

Merged
obiwac merged 1 commit intomainfrom
bugfix/max-size-str-params
Aug 31, 2025
Merged

umber.h: Don't set string size in umber_class_new params#16
obiwac merged 1 commit intomainfrom
bugfix/max-size-str-params

Conversation

@obiwac
Copy link
Member

@obiwac obiwac commented Aug 31, 2025

I initially thought these parameter annotations would indicate a maximum size array that could be passed to them. Unfortunately they actually indicate an exact size to be passed. When compiling with certain compilers:

gv.c:28:15: error: ‘umber_class_new’ reading 32 bytes from a region of size 12 [-Werror=stringop-overread] 28 | cls = umber_class_new("aqua.kos.gv", UMBER_LVL_INFO, "KOS GrapeVine interaction."); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gv.c:28:15: note: referencing argument 1 of type ‘const char[32]’

The solution is just to turn these into boring old pointers and to just document the max sizes in the doc comment.

I initially thought these parameter annotations would indicate a maximum
size array that could be passed to them. Unfortunately they actually
indicate an exact size to be passed. When compiling with certain
compilers:

gv.c:28:15: error: ‘umber_class_new’ reading 32 bytes from a region of size 12 [-Werror=stringop-overread] 28 | cls = umber_class_new("aqua.kos.gv", UMBER_LVL_INFO, "KOS GrapeVine interaction."); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gv.c:28:15: note: referencing argument 1 of type ‘const char[32]’

The solution is just to turn these into boring old pointers and to just
document the max sizes in the doc comment.
@obiwac obiwac added the bug Something isn't working label Aug 31, 2025
@obiwac obiwac merged commit 7952016 into main Aug 31, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments