summaryrefslogtreecommitdiff
blob: fe82fb2bbc92b49c77feb48b870fa950cd83a045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
http://bugs.gentoo.org/show_bug.cgi?id=297579

--- src/mms.c
+++ src/mms.c
@@ -1021,10 +1021,15 @@
       
       /* forces the asf demuxer to not choose this stream */
       if (this->streams[i].bitrate_pos) {
-        this->asf_header[this->streams[i].bitrate_pos    ] = 0;
-        this->asf_header[this->streams[i].bitrate_pos + 1] = 0;
-        this->asf_header[this->streams[i].bitrate_pos + 2] = 0;
-        this->asf_header[this->streams[i].bitrate_pos + 3] = 0;
+        if (this->streams[i].bitrate_pos+3 <= ASF_HEADER_LEN) {
+          this->asf_header[this->streams[i].bitrate_pos    ] = 0;
+          this->asf_header[this->streams[i].bitrate_pos + 1] = 0;
+          this->asf_header[this->streams[i].bitrate_pos + 2] = 0;
+          this->asf_header[this->streams[i].bitrate_pos + 3] = 0;
+        } else {
+          lprintf("***LOG:*** -- "
+                  "libmms: attempt to write beyond asf header limit");
+        }
       }
     }
   }