Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure VLA size is at least one #192

Merged
merged 1 commit into from
Sep 5, 2021

Conversation

rkta
Copy link
Contributor

@rkta rkta commented Sep 1, 2021

Compiling with GCC 10.2 with -fsanitize=address,undefined valgrind
and opening the 'option panel' reports:
table.c:1632:8: runtime error: variable length array bound evaluates to non-positive value 0
table.c:1266:11: runtime error: variable length array bound evaluates to non-positive value 0
table.c:1267:12: runtime error: variable length array bound evaluates to non-positive value 0

'maxcell' is initialized to -1 which results in a size of 0 during the
first iteration. Though the array is only accessed if maxcell >= 0,
using a variable length array with a size < 1 is undefined behaviour
(see e.g. C99 6.7.5.2,p5).

This closes issue #51 .

Compiling with GCC 10.2 with -fsanitize=address,undefined valgrind
and opening the 'opions panel' reports:
table.c:1632:8: runtime error: variable length array bound evaluates to non-positive value 0
table.c:1266:11: runtime error: variable length array bound evaluates to non-positive value 0
table.c:1267:12: runtime error: variable length array bound evaluates to non-positive value 0

'maxcell' is initialized to -1 which results in a size of 0 during the
first iteration. Though the array is only accessed if maxcell >= 0,
using a variable length array with a size < 1 is undefined behaviour
(see e.g. C99 6.7.5.2,p5).

This closes issue tats#51 .
@rkta rkta force-pushed the table_ensure_vla_size_is_greater_0 branch from 4a23056 to 12c7b62 Compare September 2, 2021 08:33
@tats tats merged commit ef493bd into tats:master Sep 5, 2021
@tats
Copy link
Owner

tats commented Sep 5, 2021

Merged, thanks for your contribution.

@rkta rkta deleted the table_ensure_vla_size_is_greater_0 branch May 1, 2022 09:46
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.

None yet

2 participants