Fixes out of array accesses
Unified · Split
| @@ -92,13 +92,13 @@ static int movie_request_frame(AVFilterLink *outlink); · 91 unmodified lines | ||
| 92 | 92 | static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) |
| 93 | 93 | { |
| 94 | 94 | int i, ret, already = 0, stream_id = -1; |
| 95 | − char type_char, dummy; | |
| 95 | + char type_char[2], dummy; | |
| 96 | 96 | AVStream *found = NULL; |
| 97 | 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 | 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 | 102 | ret = av_find_best_stream(avf, type, stream_id, -1, NULL, 0); |
| 103 | 103 | if (ret < 0) { |
| 104 | 104 | av_log(log, AV_LOG_ERROR, "No %s stream with index '%d' found\n", |