From: Josh Coalson Date: Wed, 3 Sep 2003 00:54:37 +0000 (+0000) Subject: fix possibly uninitialized var if a file has no STREAMINFO block X-Git-Tag: 1.2.0~1050 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bef021a1813264f2d89fae58460b40832d1c11cb;p=platform%2Fupstream%2Fflac.git fix possibly uninitialized var if a file has no STREAMINFO block --- diff --git a/src/metaflac/operations_shorthand_cuesheet.c b/src/metaflac/operations_shorthand_cuesheet.c index f61d8f8d..0998a37c 100644 --- a/src/metaflac/operations_shorthand_cuesheet.c +++ b/src/metaflac/operations_shorthand_cuesheet.c @@ -30,7 +30,7 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata FLAC__bool ok = true; FLAC__StreamMetadata *cuesheet = 0; FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - FLAC__uint64 lead_out_offset; + FLAC__uint64 lead_out_offset = 0; if(0 == iterator) die("out of memory allocating iterator"); @@ -56,6 +56,12 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata cuesheet = block; } while(FLAC__metadata_iterator_next(iterator)); + if(lead_out_offset == 0) { + fprintf(stderr, "%s: ERROR: FLAC stream has no STREAMINFO block\n", filename); + FLAC__metadata_iterator_delete(iterator); + return false; + } + switch(operation->type) { case OP__IMPORT_CUESHEET_FROM: if(0 != cuesheet) {