avfilter/ass: make sure the log level are in available range
authorClément Bœsch <u@pkh.me>
Thu, 11 Sep 2014 19:09:39 +0000 (21:09 +0200)
committerClément Bœsch <u@pkh.me>
Tue, 16 Sep 2014 19:23:33 +0000 (21:23 +0200)
libavfilter/vf_subtitles.c

index 4fa1174..44273cb 100644 (file)
@@ -80,7 +80,9 @@ static const int ass_libavfilter_log_level_map[] = {
 
 static void ass_log(int ass_level, const char *fmt, va_list args, void *ctx)
 {
-    int level = ass_libavfilter_log_level_map[ass_level];
+    const int ass_level_clip = av_clip(ass_level, 0,
+        FF_ARRAY_ELEMS(ass_libavfilter_log_level_map) - 1);
+    const int level = ass_libavfilter_log_level_map[ass_level_clip];
 
     av_vlog(ctx, level, fmt, args);
     av_log(ctx, level, "\n");