changeset 4141:657498d1307e libavformat

Add a few error checks to rm_assemble_video_frame()
author michael
date Tue, 30 Dec 2008 20:51:18 +0000
parents 68230afdf021
children 5d57b8a9e597
files rmdec.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rmdec.c	Tue Dec 30 19:49:27 2008 +0000
+++ b/rmdec.c	Tue Dec 30 20:51:18 2008 +0000
@@ -498,10 +498,14 @@
         seq = get_byte(pb); len--;
         len2 = get_num(pb, &len);
         pos = get_num(pb, &len);
+        if(len < 1)
+            return -1;
         pic_num = get_byte(pb); len--;
         rm->remaining_len = len;
         break;
     case 1: //whole frame
+        if(len<1)
+            return -1;
         seq = get_byte(pb); len--;
         if(av_new_packet(pkt, len + 9) < 0)
             return AVERROR(EIO);
@@ -515,6 +519,8 @@
         len2 = get_num(pb, &len);
         pos = get_num(pb, &len);
         pic_num = get_byte(pb); len--;
+        if(len < len2)
+            return -1;
         rm->remaining_len = len - len2;
         if(av_new_packet(pkt, len2 + 9) < 0)
             return AVERROR(EIO);