Fixes out of array accesses
Unified · Split
| @@ -92,13 +92,13 @@ static int movie_request_frame(AVFilterLink *outlink); · 91 unmodified lines | |||
| 92 | static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) | 92 | static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) |
| 93 | { | 93 | { |
| 94 | int i, ret, already = 0, stream_id = -1; | 94 | int i, ret, already = 0, stream_id = -1; |
| 95 | char type_char, dummy; | 95 | char type_char[2], dummy; |
| 96 | AVStream *found = NULL; | 96 | AVStream *found = NULL; |
| 97 | enum AVMediaType type; | 97 | enum AVMediaType type; |
| 98 | 98 | ||
| 99 | ret = sscanf(spec, "d%[av]%d%c", &type_char, &stream_id, &dummy); | 99 | ret = sscanf(spec, "d%1[av]%d%c", type_char, &stream_id, &dummy); |
| 100 | if (ret >= 1 && ret <= 2) { | 100 | if (ret >= 1 && ret <= 2) { |
| 101 | type = type_char == 'v' ? AVMEDIA_TYPE_VIDEO : AVMEDIA_TYPE_AUDIO; | 101 | type = type_char[0] == 'v' ? AVMEDIA_TYPE_VIDEO : AVMEDIA_TYPE_AUDIO; |
| 102 | ret = av_find_best_stream(avf, type, stream_id, -1, NULL, 0); | 102 | ret = av_find_best_stream(avf, type, stream_id, -1, NULL, 0); |
| 103 | if (ret < 0) { | 103 | if (ret < 0) { |
| 104 | av_log(log, AV_LOG_ERROR, "No %s stream with index '%d' found\n", | 104 | av_log(log, AV_LOG_ERROR, "No %s stream with index '%d' found\n", |