avformat/dhav: Check amount read
Prevents potential use of uninitialized data in the following memcmp(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
cf6d07522a
commit
d8cad01805
1 changed files with 3 additions and 1 deletions
|
@ -278,7 +278,9 @@ static int dhav_read_header(AVFormatContext *s)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
avio_read(s->pb, signature, sizeof(signature));
|
ret = ffio_read_size(s->pb, signature, sizeof(signature));
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
if (!memcmp(signature, "DAHUA", 5)) {
|
if (!memcmp(signature, "DAHUA", 5)) {
|
||||||
avio_skip(s->pb, 0x400 - 5);
|
avio_skip(s->pb, 0x400 - 5);
|
||||||
dhav->last_good_pos = avio_tell(s->pb);
|
dhav->last_good_pos = avio_tell(s->pb);
|
||||||
|
|
Loading…
Add table
Reference in a new issue