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

tidy-html5:tidy_fuzzer: Heap-buffer-overflow in prvTidyEncodeCharToUTF8Bytes #1138

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

ddkilzer
Copy link

https://issues.oss-fuzz.com/issues/42498297

Found by oss-fuzz.

Fixes potential out-of-bounds write in both NormalizeSpaces() and DowngradeTypography(). Adds assert() statements to catch more bugs with fuzzing.

  • src/clean.c: (NormalizeSpaces):
    (DowngradeTypography):
  • Use a temporary buffer when calling PutUTF8() to avoid a heap buffer overflow write and to avoid clobbering data in-place.
  • Handle all possible return values after calling PutUTF8().
  • src/utf8.c: (DecodeUTF8BytesToChar):
    (GetUTF8):
    (PutUTF8):
  • Add assert() statements to catch bugs during fuzzing.

…F8Bytes

<https://issues.oss-fuzz.com/issues/42498297>

Found by oss-fuzz.

Fixes potential out-of-bounds write in both NormalizeSpaces() and
DowngradeTypography(). Adds assert() statements to catch more bugs with
fuzzing.

* src/clean.c:
(NormalizeSpaces):
(DowngradeTypography):
- Use a temporary buffer when calling PutUTF8() to avoid a heap buffer
  overflow write and to avoid clobbering data in-place.
- Handle all possible return values after calling PutUTF8().
* src/utf8.c:
(DecodeUTF8BytesToChar):
(GetUTF8):
(PutUTF8):
- Add assert() statements to catch bugs during fuzzing.
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