metadata_iterators.c: Add missing check for is_writable
authorErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 15 Jan 2016 20:57:26 +0000 (07:57 +1100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 15 Jan 2016 20:58:03 +0000 (07:58 +1100)
Patch-from: lvqcl <lvqcl.mail@gmail.com>

src/libFLAC/metadata_iterators.c

index 4527878..4fd58c8 100644 (file)
@@ -837,6 +837,11 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_S
        FLAC__ASSERT_DECLARATION(FLAC__off_t debug_target_offset = iterator->offset[iterator->depth];)
        FLAC__bool ret;
 
+       if(!iterator->is_writable) {
+               iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE;
+               return false;
+       }
+
        if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT;
                return false;