Skip to content

fix two possible buffer overflow bugs#296

Open
Frank-Buss wants to merge 1 commit intoChia-Network:mainfrom
Frank-Buss:frankbuss/fix-buffer-overflow
Open

fix two possible buffer overflow bugs#296
Frank-Buss wants to merge 1 commit intoChia-Network:mainfrom
Frank-Buss:frankbuss/fix-buffer-overflow

Conversation

@Frank-Buss
Copy link

@Frank-Buss Frank-Buss commented Jan 23, 2026

Note

Adds strict input-size validation during session initialization to prevent buffer overflows.

  • In InitSession, validate disc_int_size against sizeof(disc) and throw on invalid values
  • Validate form_size against sizeof(initial_form_s) and throw on invalid values

Written by Cursor Bugbot for commit 216bb7a. This will update automatically on new commits. Configure here.

@Frank-Buss
Copy link
Author

PS: technically the test for <= 0 is a semantic change, but disc size can't be 0 because the discriminant is a prime used to define the class group, which can't be represented with zero bytes. Additionally, atoi returns 0 for non-numeric input, so this catches malformed sizes. And the binary quadratic form also requires actual coefficients, so can't be 0 either. Finally, form_size is a signed char, so <= 0 catches wire values 128-255 that wrap negative.

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.

1 participant