changeset 3237:4fa7ec10b57e libavformat

Compute AC3 frame CRC for stronger raw AC3 format probing. Closes issue64.
author andoma
date Mon, 21 Apr 2008 15:20:53 +0000
parents 57baf1166899
children db733a434b2c
files raw.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/raw.c	Mon Apr 21 08:19:16 2008 +0000
+++ b/raw.c	Mon Apr 21 15:20:53 2008 +0000
@@ -22,6 +22,7 @@
 #include "avformat.h"
 #include "ac3_parser.h"
 #include "raw.h"
+#include "crc.h"
 
 #ifdef CONFIG_MUXERS
 /* simple formats */
@@ -429,6 +430,9 @@
         for(frames = 0; buf2 < end; frames++) {
             if(ff_ac3_parse_header(buf2, &hdr) < 0)
                 break;
+            if(buf2 + hdr.frame_size > end ||
+               av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
+                break;
             buf2 += hdr.frame_size;
         }
         max_frames = FFMAX(max_frames, frames);