Commit 61607377 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

stream_decoder.c: Set obj->num_comments before return

Make sure obj-num_comments gets set on failure conditions.

Patch-from: Robert Shih <robertshih@google.com>
parent a9f84425
...@@ -1767,6 +1767,7 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre ...@@ -1767,6 +1767,7 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
length -= obj->comments[i].length; length -= obj->comments[i].length;
if (0 == (obj->comments[i].entry = safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) { if (0 == (obj->comments[i].entry = safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
obj->num_comments = i;
return false; return false;
} }
memset (obj->comments[i].entry, 0, obj->comments[i].length) ; memset (obj->comments[i].entry, 0, obj->comments[i].length) ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment