diff options
author | Michael Niedermayer | 2014-02-12 15:51:38 +0100 |
---|---|---|
committer | Michael Niedermayer | 2014-02-12 15:59:15 +0100 |
commit | d32926db7f4224305a08510c3adc2a3467b3ab2f (patch) | |
tree | f91cf1926cd3feb804b2b810b99e476824e84cf3 /libavformat | |
parent | 8c5fece11fcb845f459eebb86b03f98d39e5880c (diff) |
avformat/riff: return error code from ff_get_guid()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/riff.h | 2 | ||||
-rw-r--r-- | libavformat/riffdec.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/riff.h b/libavformat/riff.h index b59c6065a0..dba38034e9 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -91,7 +91,7 @@ static av_always_inline int ff_guidcmp(const void *g1, const void *g2) return memcmp(g1, g2, sizeof(ff_asf_guid)); } -void ff_get_guid(AVIOContext *s, ff_asf_guid *g); +int ff_get_guid(AVIOContext *s, ff_asf_guid *g); void ff_put_guid(AVIOContext *s, const ff_asf_guid *g); const ff_asf_guid *get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid); diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c index c1e9ec1532..48c9a941b7 100644 --- a/libavformat/riffdec.c +++ b/libavformat/riffdec.c @@ -29,11 +29,14 @@ #include "avio_internal.h" #include "riff.h" -void ff_get_guid(AVIOContext *s, ff_asf_guid *g) +int ff_get_guid(AVIOContext *s, ff_asf_guid *g) { av_assert0(sizeof(*g) == 16); //compiler will optimize this out - if (avio_read(s, *g, sizeof(*g)) < (int)sizeof(*g)) + if (avio_read(s, *g, sizeof(*g)) < (int)sizeof(*g)) { memset(*g, 0, sizeof(*g)); + return AVERROR_INVALIDDATA; + } + return 0; } enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid) |