Unified · Split
| @@ -1531,6 +1531,26 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, · 1530 unmodified lines | ||
| 1531 | 1531 | st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE; |
| 1532 | 1532 | st->codec->time_base.den = st->codec->extradata[16]; /* number of frame */ |
| 1533 | 1533 | st->codec->time_base.num = 1; |
| 1534 | + if (size > 30) { | |
| 1535 | + uint32_t len = AV_RB32(st->codec->extradata + 18); /* name atom length */ | |
| 1536 | + uint32_t format = AV_RB32(st->codec->extradata + 22); | |
| 1537 | + if (format == AV_RB32("name") && (int64_t)size >= (int64_t)len + 18) { | |
| 1538 | + uint16_t str_size = AV_RB16(st->codec->extradata + 26); /* string length */ | |
| 1539 | + if (str_size > 0 && size >= (int)str_size + 26) { | |
| 1540 | + char *reel_name = av_malloc(str_size + 1); | |
| 1541 | + if (!reel_name) | |
| 1542 | + return AVERROR(ENOMEM); | |
| 1543 | + memcpy(reel_name, st->codec->extradata + 30, str_size); | |
| 1544 | + reel_name[str_size] = 0; /* Add null terminator */ | |
| 1545 | + /* don't add reel_name if emtpy string */ | |
| 1546 | + if (*reel_name == 0) { | |
| 1547 | + av_free(reel_name); | |
| 1548 | + } else { | |
| 1549 | + av_dict_set(&st->metadata, "reel_name", reel_name, AV_DICT_DONT_STRDUP_VAL); | |
| 1550 | + } | |
| 1551 | + } | |
| 1552 | + } | |
| 1553 | + } | |
| 1534 | 1554 | } |
| 1535 | 1555 | } else { |
| 1536 | 1556 | /* other codec type, just skip (rtp, mp4s ...) */ |