Commit 61e0e809 authored by Michael Niedermayer's avatar Michael Niedermayer

tiff: continue parsing on non fatal errors

Reviewed-by: 's avatarThilo Borgmann <thilo.borgmann@mail.de>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 8e119a22
...@@ -710,7 +710,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) ...@@ -710,7 +710,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
if (type == 0 || type >= FF_ARRAY_ELEMS(type_sizes)) { if (type == 0 || type >= FF_ARRAY_ELEMS(type_sizes)) {
av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n", av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n",
type); type);
return 0; goto end;
} }
if (count == 1) { if (count == 1) {
...@@ -928,7 +928,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) ...@@ -928,7 +928,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
#define ADD_METADATA(count, name, sep)\ #define ADD_METADATA(count, name, sep)\
if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\ if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\ av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\
return ret;\ goto end;\
} }
case TIFF_MODEL_PIXEL_SCALE: case TIFF_MODEL_PIXEL_SCALE:
ADD_METADATA(count, "ModelPixelScaleTag", NULL); ADD_METADATA(count, "ModelPixelScaleTag", NULL);
...@@ -955,7 +955,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) ...@@ -955,7 +955,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
if (!s->geotags) { if (!s->geotags) {
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
s->geotag_count = 0; s->geotag_count = 0;
return AVERROR(ENOMEM); goto end;
} }
for (i = 0; i < s->geotag_count; i++) { for (i = 0; i < s->geotag_count; i++) {
s->geotags[i].key = tget_short(&s->gb, s->le); s->geotags[i].key = tget_short(&s->gb, s->le);
...@@ -976,7 +976,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) ...@@ -976,7 +976,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
dp = av_malloc(count * sizeof(double)); dp = av_malloc(count * sizeof(double));
if (!dp) { if (!dp) {
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
return AVERROR(ENOMEM); goto end;
} }
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
dp[i] = tget_double(&s->gb, s->le); dp[i] = tget_double(&s->gb, s->le);
...@@ -1064,6 +1064,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame) ...@@ -1064,6 +1064,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
} }
end:
bytestream2_seek(&s->gb, start, SEEK_SET); bytestream2_seek(&s->gb, start, SEEK_SET);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment