aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-05 19:24:33 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-06 12:40:49 +0100
commit51ac1ce9668f6918593b0a937b9b98713f29e2e4 (patch)
tree0beb34a2b6e40cb024ecd6493f3913e4fb3e25c2
parentfe191124a9cabdd77b22f1a157583f8c7b4b34c8 (diff)
downloadffmpeg-51ac1ce9668f6918593b0a937b9b98713f29e2e4.tar.gz
libavutil/channel_layout: Check strtol*() for failure
Fixes assertion failure Fixes: 4f5814bb15d2dda6fc18ef9791b13816/signal_sigabrt_7ffff6ae7cc9_65_7209d160d168b76f311be6cd64a548eb.wv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit c9bfd6a8c35a2102e730aca12f6e09d1627f76b3) Conflicts: libavutil/channel_layout.c
-rw-r--r--libavutil/channel_layout.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index cd5cf426d4..45249c4367 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -125,6 +125,8 @@ static uint64_t get_channel_layout_single(const char *name, int name_len)
strlen(channel_names[i].name) == name_len &&
!memcmp(channel_names[i].name, name, name_len))
return (int64_t)1 << i;
+
+ errno = 0;
i = strtol(name, &end, 10);
#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
@@ -143,14 +145,15 @@ static uint64_t get_channel_layout_single(const char *name, int name_len)
}
} else {
#endif
- if ((end + 1 - name == name_len && *end == 'c'))
+ if (!errno && (end + 1 - name == name_len && *end == 'c'))
return av_get_default_channel_layout(i);
#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
}
#endif
+ errno = 0;
layout = strtoll(name, &end, 0);
- if (end - name == name_len)
+ if (!errno && end - name == name_len)
return FFMAX(layout, 0);
return 0;
}