changeset 5176:36225b62e091 libavformat

Check buffer size for idcin check, otherwise false positives are too likely for small probe buffer sizes due to 0-padding (see probetest results).
author reimar
date Mon, 14 Sep 2009 15:44:05 +0000
parents 1dbe578de8e6
children 951c95954c9c
files idcin.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/idcin.c	Sun Sep 13 20:08:47 2009 +0000
+++ b/idcin.c	Mon Sep 14 15:44:05 2009 +0000
@@ -105,6 +105,11 @@
      * audio channels: 0 for no audio, or 1 or 2
      */
 
+    /* check we have enough data to do all checks, otherwise the
+       0-padding may cause a wrong recognition */
+    if (p->buf_size < 20)
+        return 0;
+
     /* check the video width */
     number = AV_RL32(&p->buf[0]);
     if ((number == 0) || (number > 1024))