Browse Source

flv: Validate the packet size

Size can be negative at that point.

Bug-Id: 1041
CC: libav-stable@libav.org
tags/n4.0
Luca Barbato 8 years ago
parent
commit
279e3aaa14
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      libavformat/flvdec.c

+ 6
- 0
libavformat/flvdec.c View File

@@ -912,6 +912,12 @@ skip:
st->codecpar->codec_id == AV_CODEC_ID_H264) { st->codecpar->codec_id == AV_CODEC_ID_H264) {
int type = avio_r8(s->pb); int type = avio_r8(s->pb);
size--; size--;

if (size < 0) {
ret = AVERROR_INVALIDDATA;
goto leave;
}

if (st->codecpar->codec_id == AV_CODEC_ID_H264) { if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
// sign extension // sign extension
int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000; int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;


Loading…
Cancel
Save