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

Add a bound check for sas7bcat_parse_value_labels when finding the offset of labels. #303

Conversation

kiwiwarmnfuzzy
Copy link

@kiwiwarmnfuzzy kiwiwarmnfuzzy commented Jul 26, 2023

lbp1 will try to chase and read as many value labels as label_count_capacity, which may result in accessing memory locations past the allocated region, especially for malformed data. This also results in Address sanitizer error on some inputs. Add a bounds check to avoid it.

Closes #299
Maybe related to #285

`lbp1` will try to chase and read as many value labels as `label_count_capacity`, which may result in accessing memory locations pass the allocated region, especially for malformed data. This also results in Address sanitizer error on some inputs. Add a bounds check to avoid it.
@kiwiwarmnfuzzy
Copy link
Author

@evanmiller Hi there! Please take a look when you have time - this addresses one of the vulnerabilities identified by our fuzzing tool; realistically, this can happen with incorrect or malformed data.

@evanmiller
Copy link
Contributor

Hi, I'm just confused because I thought line 63 was performing this check

        if (&lbp1[3] - value_start > value_labels_len || sas_read2(&lbp1[2], ctx->bswap) < 0) {

But maybe I'm missing something?

@evanmiller
Copy link
Contributor

Ah, looks like a regression introduced in #293. I will prepare a fix.

@evanmiller evanmiller closed this in 32f64d3 May 4, 2024
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.

Security: Heap-buffer-overflow in sas_read2
2 participants