summaryrefslogtreecommitdiff
path: root/src/libvdpau/h264_parser.c
diff options
context:
space:
mode:
authorJulian Scheel <julian@jusst.de>2009-01-07 17:34:55 +0000
committerJulian Scheel <julian@jusst.de>2009-01-07 17:34:55 +0000
commitff79b3c43b90c2b76e5557e9606461a775c71488 (patch)
tree55215ca983166b51ee67d02cc738018ee263d97a /src/libvdpau/h264_parser.c
parent9c7d9494c7b2131feab6c20449358c61f0f7d553 (diff)
downloadxine-lib-ff79b3c43b90c2b76e5557e9606461a775c71488.tar.gz
xine-lib-ff79b3c43b90c2b76e5557e9606461a775c71488.tar.bz2
Fix a possible buf underrun -> crash.
Diffstat (limited to 'src/libvdpau/h264_parser.c')
-rw-r--r--src/libvdpau/h264_parser.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libvdpau/h264_parser.c b/src/libvdpau/h264_parser.c
index fdc48f043..fcec0b92e 100644
--- a/src/libvdpau/h264_parser.c
+++ b/src/libvdpau/h264_parser.c
@@ -1201,6 +1201,13 @@ int parse_frame(struct nal_parser *parser, uint8_t *inbuf, int inbuf_len,
* copy the left data into prebuf
*/
if(parsed_len < inbuf_len) {
+ if (inbuf_len-parsed_len + parser->prebuf_len > MAX_FRAME_SIZE) {
+ printf("buf underrun!!\n");
+ parser->prebuf_len = 0;
+ *ret_len = 0;
+ *ret_buf = NULL;
+ return parsed_len;
+ }
parser->incomplete_nal = 1;
xine_fast_memcpy(parser->prebuf + parser->prebuf_len, inbuf, inbuf_len-parsed_len);
parser->prebuf_len += inbuf_len-parsed_len;