icodec: correctly check avio_read return value
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tue, 8 Nov 2016 22:29:28 +0000 (23:29 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Thu, 17 Nov 2016 22:16:48 +0000 (23:16 +0100)
commit1615d83dcf6ed0401be2f8afbdd8af8d2fc56815
treef342fbb336673314d3f76975db70c44e4aeb41c1
parent41359d381a2b5f5057502b2839b5eb42af69804f
icodec: correctly check avio_read return value

It can read less than the requested amount, in which case buf contains
uninitialized data, causing problems like segmentation faults later on.

Also make sure that image->size is positive, so that it can't match a
negative error code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 89eb398c7fc4cb9a15e55bdf2ab6435b5332e377)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/icodec.c