Commit 91b71460 authored by Justin Ruggles's avatar Justin Ruggles

apedec: return meaningful error values in ape_decode_frame()

parent c6defb41
...@@ -820,7 +820,7 @@ static int ape_decode_frame(AVCodecContext *avctx, ...@@ -820,7 +820,7 @@ static int ape_decode_frame(AVCodecContext *avctx,
/* should not happen but who knows */ /* should not happen but who knows */
if (BLOCKS_PER_LOOP * 2 * avctx->channels > *data_size) { if (BLOCKS_PER_LOOP * 2 * avctx->channels > *data_size) {
av_log (avctx, AV_LOG_ERROR, "Output buffer is too small.\n"); av_log (avctx, AV_LOG_ERROR, "Output buffer is too small.\n");
return -1; return AVERROR(EINVAL);
} }
if(!s->samples){ if(!s->samples){
...@@ -834,7 +834,7 @@ static int ape_decode_frame(AVCodecContext *avctx, ...@@ -834,7 +834,7 @@ static int ape_decode_frame(AVCodecContext *avctx,
if(n < 0 || n > 3){ if(n < 0 || n > 3){
av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n");
s->data = NULL; s->data = NULL;
return -1; return AVERROR_INVALIDDATA;
} }
s->ptr += n; s->ptr += n;
...@@ -871,7 +871,7 @@ static int ape_decode_frame(AVCodecContext *avctx, ...@@ -871,7 +871,7 @@ static int ape_decode_frame(AVCodecContext *avctx,
if(s->error || s->ptr > s->data_end){ if(s->error || s->ptr > s->data_end){
s->samples=0; s->samples=0;
av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n");
return -1; return AVERROR_INVALIDDATA;
} }
for (i = 0; i < blockstodecode; i++) { for (i = 0; i < blockstodecode; i++) {
......
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