Fixes issue 2563.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 4acc94e97a9551d11ead29735e23283d71f1d4c2)
| ... | ... |
@@ -85,8 +85,8 @@ static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, |
| 85 | 85 |
|
| 86 | 86 |
static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type) |
| 87 | 87 |
{
|
| 88 |
- tag[0] = '0'; |
|
| 89 |
- tag[1] = '0' + index; |
|
| 88 |
+ tag[0] = '0' + index/10; |
|
| 89 |
+ tag[1] = '0' + index%10; |
|
| 90 | 90 |
if (type == AVMEDIA_TYPE_VIDEO) {
|
| 91 | 91 |
tag[2] = 'd'; |
| 92 | 92 |
tag[3] = 'c'; |
| ... | ... |
@@ -158,6 +158,12 @@ static int avi_write_header(AVFormatContext *s) |
| 158 | 158 |
int64_t list1, list2, strh, strf; |
| 159 | 159 |
AVMetadataTag *t = NULL; |
| 160 | 160 |
|
| 161 |
+ if (s->nb_streams > AVI_MAX_STREAM_COUNT) {
|
|
| 162 |
+ av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n", |
|
| 163 |
+ AVI_MAX_STREAM_COUNT); |
|
| 164 |
+ return -1; |
|
| 165 |
+ } |
|
| 166 |
+ |
|
| 161 | 167 |
for(n=0;n<s->nb_streams;n++) {
|
| 162 | 168 |
s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream)); |
| 163 | 169 |
if(!s->streams[n]->priv_data) |