[FFmpeg-devel,2/2] lavf/movdec: use a more appropriate error code for bad trun atoms

Submitted by Rodger Combs on March 16, 2019, 10:22 a.m.

Details

Message ID 20190316102203.69741-2-rodger.combs@gmail.com
State New
Headers show

Commit Message

Rodger Combs March 16, 2019, 10:22 a.m.
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer March 17, 2019, 10:13 a.m.
On Sat, Mar 16, 2019 at 05:22:03AM -0500, Rodger Combs wrote:
> ---
>  libavformat/mov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 0dfee2e7c4..9ed109962f 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -4785,7 +4785,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>          av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n");
>      }
>      if (entries <= 0)
> -        return -1;
> +        return AVERROR_INVALIDDATA;

not sure this is the best error code here but its better than -1

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0dfee2e7c4..9ed109962f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4785,7 +4785,7 @@  static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n");
     }
     if (entries <= 0)
-        return -1;
+        return AVERROR_INVALIDDATA;
 
     requested_size = (st->nb_index_entries + entries) * sizeof(AVIndexEntry);
     new_entries = av_fast_realloc(st->index_entries,