src/libFLAC/stream_decoder.c : Fix buffer read overflow.
[platform/upstream/flac.git] / src / libFLAC / stream_decoder.c
index f987c27..6bc6407 100644 (file)
@@ -71,7 +71,7 @@ FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC =
  *
  ***********************************************************************/
 
-static FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' };
+static const FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' };
 
 /***********************************************************************
  *
@@ -1365,6 +1365,10 @@ FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder)
                        id = 0;
                        continue;
                }
+
+               if(id >= 3)
+                       return false;
+
                if(x == ID3V2_TAG_[id]) {
                        id++;
                        i = 0;