[lbpng16] Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue.
This commit is contained in:
parent
c5c778bcfc
commit
39d84f4f6a
2
ANNOUNCE
2
ANNOUNCE
@ -87,6 +87,8 @@ Version 1.6.32beta11 [August 6, 2017]
|
||||
Removed unused chunk_name parameter from png_check_chunk_length().
|
||||
Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak.
|
||||
Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue.
|
||||
Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR.
|
||||
Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
2
CHANGES
2
CHANGES
@ -5970,6 +5970,8 @@ Version 1.6.32beta11 [August 6, 2017]
|
||||
Removed unused chunk_name parameter from png_check_chunk_length().
|
||||
Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak.
|
||||
Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue.
|
||||
Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR.
|
||||
Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
35
pngrutil.c
35
pngrutil.c
@ -2636,23 +2636,28 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_text text;
|
||||
|
||||
/* It worked; png_ptr->read_buffer now looks like a tEXt chunk except
|
||||
* for the extra compression type byte and the fact that it isn't
|
||||
* necessarily '\0' terminated.
|
||||
*/
|
||||
buffer = png_ptr->read_buffer;
|
||||
buffer[uncompressed_length+(keyword_length+2)] = 0;
|
||||
if (png_ptr->read_buffer == NULL)
|
||||
errmsg="Read failure in png_handle_zTXt";
|
||||
else
|
||||
{
|
||||
/* It worked; png_ptr->read_buffer now looks like a tEXt chunk
|
||||
* except for the extra compression type byte and the fact that
|
||||
* it isn't necessarily '\0' terminated.
|
||||
*/
|
||||
buffer = png_ptr->read_buffer;
|
||||
buffer[uncompressed_length+(keyword_length+2)] = 0;
|
||||
|
||||
text.compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text.key = (png_charp)buffer;
|
||||
text.text = (png_charp)(buffer + keyword_length+2);
|
||||
text.text_length = uncompressed_length;
|
||||
text.itxt_length = 0;
|
||||
text.lang = NULL;
|
||||
text.lang_key = NULL;
|
||||
text.compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text.key = (png_charp)buffer;
|
||||
text.text = (png_charp)(buffer + keyword_length+2);
|
||||
text.text_length = uncompressed_length;
|
||||
text.itxt_length = 0;
|
||||
text.lang = NULL;
|
||||
text.lang_key = NULL;
|
||||
|
||||
if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
|
||||
errmsg = "insufficient memory";
|
||||
if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
|
||||
errmsg = "insufficient memory";
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user