Skip to content

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

Open
ddkilzer wants to merge 1 commit into
htacg:nextfrom
ddkilzer:ddkilzer/oss-fuzz-42498297
Open

tidy-html5:tidy_fuzzer: Heap-buffer-overflow in prvTidyEncodeCharToUTF8Bytes#1138
ddkilzer wants to merge 1 commit into
htacg:nextfrom
ddkilzer:ddkilzer/oss-fuzz-42498297

Conversation

@ddkilzer

Copy link
Copy Markdown

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