History

src_movie: fix scanf string

Fixes out of array accesses

Michael Niedermayer committed 13 years ago

Commit adaa7741 parent 369a1201 file · +3 −3Browse files

Unified · Split

libavfilter/src_movie.c+3−3
@@ -92,13 +92,13 @@ static int movie_request_frame(AVFilterLink *outlink); · 91 unmodified lines
9292 static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
9393 {
9494 int i, ret, already = 0, stream_id = -1;
95− char type_char, dummy;
95+ char type_char[2], dummy;
9696 AVStream *found = NULL;
9797 enum AVMediaType type;
9898
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);
100100 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;
102102 ret = av_find_best_stream(avf, type, stream_id, -1, NULL, 0);
103103 if (ret < 0) {
104104 av_log(log, AV_LOG_ERROR, "No %s stream with index '%d' found\n",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t