mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Attempt to debug Uninitialized Memory Read in png_set_text_2(),
detected by the oss-fuzz project.
This commit is contained in:
17
pngset.c
17
pngset.c
@@ -886,10 +886,11 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
if (text_ptr[i].text == NULL)
|
||||
text_is_null=1;
|
||||
else if (text_ptr[i].text[0] == '\0')
|
||||
else if (text_ptr[i].text[0] == '\0') /* FIX THIS */
|
||||
text_0_is_0=1;
|
||||
|
||||
if (text_is_null)
|
||||
/* oss-fuzz complains of UMR on the reference to text_0_is_0 */
|
||||
if (text_is_null || text_0_is_0)
|
||||
{
|
||||
text_length = 0;
|
||||
# ifdef PNG_iTXt_SUPPORTED
|
||||
@@ -900,18 +901,6 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
# endif
|
||||
textp->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
}
|
||||
else if (text_0_is_0)
|
||||
{
|
||||
text_length = 0;
|
||||
# ifdef PNG_iTXt_SUPPORTED
|
||||
if (text_ptr[i].compression > 0)
|
||||
textp->compression = PNG_ITXT_COMPRESSION_NONE;
|
||||
|
||||
else
|
||||
# endif
|
||||
textp->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
text_length = strlen(text_ptr[i].text);
|
||||
|
||||
Reference in New Issue
Block a user