Dereference of a null pointer #272

Closed
opened 2026-01-29 20:41:11 +00:00 by claunia · 1 comment
Owner

Originally created by @QiAnXinCodeSafe on GitHub (Mar 7, 2019).

9cd01c0437/c/enc/encode.c (L1099-L1103)

in line1099, storage may initialized to a null pointer value, because in GetBrotliStorage(), in line196( if (BROTLI_IS_OOM(m)) return NULL; ), and dereference of a null ponter in line 1102.

9cd01c0437/c/enc/encode.c (L191-L200)

Originally created by @QiAnXinCodeSafe on GitHub (Mar 7, 2019). https://github.com/google/brotli/blob/9cd01c0437e8b6010434d3491a348a5645de624b/c/enc/encode.c#L1099-L1103 in line1099, storage may initialized to a null pointer value, because in GetBrotliStorage(), in line196( if (BROTLI_IS_OOM(m)) return NULL; ), and dereference of a null ponter in line 1102. https://github.com/google/brotli/blob/9cd01c0437e8b6010434d3491a348a5645de624b/c/enc/encode.c#L191-L200
Author
Owner

@eustas commented on GitHub (Mar 7, 2019):

Hello. Thanks for reporting, but that is a "false positive".
Once BROTLI_IS_OOM returns false, it will return false ever after (or crash the app in the first place, depends on compilation options).
So, if in line 1099 NULL is returned, then line 1102 can not be reached (because of the check in line 1101).

@eustas commented on GitHub (Mar 7, 2019): Hello. Thanks for reporting, but that is a "false positive". Once `BROTLI_IS_OOM` returns `false`, it will return `false` ever after (or crash the app in the first place, depends on compilation options). So, if in line 1099 `NULL` is returned, then line 1102 can not be reached (because of the check in line 1101).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#272