Lines Matching refs:size

222     if (st->attached_pic.size >= 8 && id != AV_CODEC_ID_BMP) {
342 return mov_metadata_hmmt(c, pb, atom.size);
346 return mov_metadata_loci(c, pb, atom.size);
410 if (c->itunes_metadata && atom.size > 8) {
413 if (tag == MKTAG('d','a','t','a') && data_size <= atom.size && data_size >= 16) {
417 atom.size -= 16;
436 atom.size -= str_size;
437 if (atom.size > 8)
442 } else if (atom.size > 4 && key && !c->itunes_metadata && !raw) {
444 if (str_size > atom.size) {
452 atom.size -= 4;
454 str_size = atom.size;
462 if (atom.size < 0 || str_size >= INT_MAX/2)
479 } else if (data_type == 21 || data_type == 67) { // BE signed integer, variable size
481 } else if (data_type == 21) { // BE signed integer, variable size
498 } else if (data_type == 22) { // BE unsigned integer, variable size
597 if ((atom.size -= 5) < 0)
607 if (atom.size < 9)
613 if ((atom.size -= 9+str_len) < 0)
640 entries > (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||
658 uint32_t size = avio_rb32(pb);
661 if (size < 12 || next < 0 || next > INT64_MAX - size)
664 next += size - 4;
669 if (dref->type == MKTAG('a','l','i','s') && size > 150) {
760 av_log(c->fc, AV_LOG_DEBUG, "Unknown dref type 0x%08"PRIx32" size %"PRIu32"\n",
761 dref->type, size);
814 title_size = atom.size - 24;
982 if (atom.size < 16)
988 ff_mov_read_chan(c->fc, pb, st, atom.size - 4);
1002 if ((ret = ff_get_wav_header(c->fc, pb, st->codecpar, atom.size, 0)) < 0)
1029 if (atom.size == 0) /* wrong one (MP4) */
1161 static int aax_filter(uint8_t *input, int size, MOVContext *c)
1167 blocks = size >> 4; // trailing bytes are not encrypted!
1195 comp_brand_size = atom.size - 8;
1226 avio_skip(pb, atom.size);
1646 if (atom.size < 6) {
1684 icc_profile = av_stream_new_side_data(st, AV_PKT_DATA_ICC_PROFILE, atom.size - 4);
1687 ret = ffio_read_size(pb, icc_profile, atom.size - 4);
1732 if (atom.size < 2)
1760 uint64_t size = (uint64_t)par->extradata_size + atom.size + 8 + AV_INPUT_BUFFER_PADDING_SIZE;
1761 if (size > INT_MAX || (uint64_t)atom.size > INT_MAX)
1763 if ((err = av_reallocp(&par->extradata, size)) < 0) {
1767 par->extradata_size = size - AV_INPUT_BUFFER_PADDING_SIZE;
1771 /* Read a whole atom into the extradata return the size of the atom read, possibly truncated if != atom.size */
1775 int64_t result = atom.size;
1778 AV_WB32(buf , atom.size + 8);
1780 err = ffio_read_size(pb, buf + 8, atom.size);
1782 par->extradata_size -= atom.size;
1784 } else if (err < atom.size) {
1786 par->extradata_size -= atom.size - err;
1871 atom.size > 11) {
1882 atom.size >= 24) {
1914 if (atom.size == 16) {
1919 if (length == atom.size) {
1941 av_log(c->fc, AV_LOG_WARNING, "aclr not decoded - unexpected size %"PRId64"\n", atom.size);
1962 if ((uint64_t)atom.size > (1<<30))
1969 ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size);
1972 } else if (atom.size > 8) { /* to read frma, esds atoms */
1973 if (st->codecpar->codec_id == AV_CODEC_ID_ALAC && atom.size >= 24) {
1979 atom.size -= 8;
1981 && buffer >> 32 <= atom.size
1984 atom.size += 8;
1995 avio_skip(pb, atom.size - 24);
2002 avio_skip(pb, atom.size);
2008 * nor size unlike mov_read_extradata.
2019 if ((uint64_t)atom.size > (1<<30))
2024 atom.size -= 4;
2027 if (atom.size >= 10) {
2030 unsigned size = avio_rb32(pb);
2035 if (type == MKTAG('f','i','e','l') && size == atom.size)
2042 ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size);
2069 if (atom.size >= (1<<28) || atom.size < 7)
2077 ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 7);
2096 if (atom.size <= 40)
2100 if ((uint64_t)atom.size > (1<<30))
2104 ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 40);
2229 avio_rb32(pb); /* data size, always 0 */
2280 st->codecpar->bits_per_coded_sample = avio_rb16(pb); /* sample size */
2284 avio_rb16(pb); /* packet size = 0 */
2382 int64_t size)
2386 MOVAtom fake_atom = { .size = size };
2420 snprintf(buf, sizeof(buf), "size: %dx%d\n",
2466 AVStream *st, int64_t size)
2474 int size_keys = avio_rb32(pb); // size of keys
2507 int64_t size)
2512 if ((int)size != size)
2515 ret = ff_get_extradata(c->fc, st->codecpar, pb, size);
2518 if (size > 16) {
2526 if (size > 30) {
2529 if (format == AV_RB32("name") && (int64_t)size >= (int64_t)len + 18) {
2531 if (str_size > 0 && size >= (int)str_size + 30 &&
2546 avio_skip(pb, size);
2647 int64_t size)
2664 avio_skip(pb, size);
2690 int64_t size = avio_rb32(pb); /* size */
2692 av_log(c->fc, AV_LOG_INFO, "stsd_entries, size:%ld, format:%u\n", size, format);
2694 if (size >= 16) {
2698 } else if (size <= 7) {
2700 "invalid size %"PRId64" in stsd\n", size);
2705 size - (avio_tell(pb) - start_pos))) {
2717 "size=%"PRId64" 4CC=%s codec_type=%d\n", size,
2735 size - (avio_tell(pb) - start_pos));
2740 size - (avio_tell(pb) - start_pos));
2743 size - (avio_tell(pb) - start_pos));
2749 size - (avio_tell(pb) - start_pos));
2755 a.size = size - (avio_tell(pb) - start_pos);
2756 av_log(c->fc, AV_LOG_INFO, "stsd_entries, a.size:%d\n", a.size);
2757 if (a.size > 8) {
2760 } else if (a.size > 0)
2761 avio_skip(pb, a.size);
2798 /* Each entry contains a size (4 bytes) and format (4 bytes). */
2799 if (entries <= 0 || entries > atom.size / 8 || entries > 1024) {
2863 if ((uint64_t)entries * 12 + 4 > atom.size)
3067 av_log(c->fc, AV_LOG_ERROR, "Invalid sample field size %u\n", field_size);
3105 av_log(c->fc, AV_LOG_ERROR, "Invalid sample size %d\n", sc->sample_sizes[i]);
3244 entries = atom.size - 4;
3606 * Returns the new size ffstream(st)->index_entries if successful, else returns -1.
3616 int size, int distance, int flags)
3647 ie->size= size;
3728 // Hence the video delay (which is the buffer size used to sort DTS and output PTS),
4034 if (add_index_entry(st, current->pos, edit_list_dts_counter, current->size,
4304 av_log(mov->fc, AV_LOG_WARNING, "STSZ sample size %d invalid (too large), ignoring\n", sc->stsz_sample_size);
4308 av_log(mov->fc, AV_LOG_WARNING, "STSZ sample size %d invalid (too small), ignoring\n", sc->stsz_sample_size);
4345 av_log(mov->fc, AV_LOG_ERROR, "Current offset %"PRId64" or sample size %u is too large\n",
4355 av_log(mov->fc, AV_LOG_ERROR, "Sample size %u is too large\n", sample_size);
4361 e->size = sample_size;
4365 "size %u, distance %u, keyframe %d\n", st->index, current_sample,
4441 unsigned size, samples;
4452 size = sc->bytes_per_frame;
4457 size = (samples / sc->samples_per_frame) * sc->bytes_per_frame;
4460 size = samples * sc->sample_size;
4468 if (size > 0x3FFFFFFF) {
4469 av_log(mov->fc, AV_LOG_ERROR, "Sample size %u is too large\n", size);
4475 e->size = size;
4479 "size %u, duration %u\n", st->index, i, current_offset, current_dts,
4480 size, samples);
4482 current_offset += size;
4765 if (atom.size < 8)
4786 "The key# %"PRIu32" in meta has invalid size:"
4815 int64_t end = av_sat_add64(avio_tell(pb), atom.size);
4884 "Unhandled or malformed custom metadata of size %"PRId64"\n", atom.size);
4896 while (atom.size > 8) {
4901 atom.size -= 4;
4904 atom.size += 8;
5057 frag->size = flags & MOV_TFHD_DEFAULT_SIZE ?
5058 avio_rb32(pb) : trex->size;
5075 num = atom.size / 4;
5112 trex->size = avio_rb32(pb);
5328 unsigned sample_size = frag->size;
5376 sti->index_entries[index_entry_pos].size = sample_size;
5385 "size %u, distance %d, keyframe %d\n", st->index,
5461 int64_t offset = av_sat_add64(avio_tell(pb), atom.size), pts, timestamp;
5520 uint32_t size = avio_rb32(pb);
5522 if (size & 0x80000000) {
5534 if (av_sat_add64(offset, size) != offset + (uint64_t)size ||
5538 offset += size;
5599 if (atom.size < 8)
5601 if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
5602 avio_skip(pb, atom.size - 4);
5606 atom.size -= 8;
5608 avio_skip(pb, atom.size);
5634 moov_len = avio_rb32(pb); /* uncompressed size */
5635 cmov_len = atom.size - 6 * 4;
5655 atom.size = moov_len;
5681 atom.size -= 8;
5684 if (atom.size != edit_count * elst_entry_size) {
5686 av_log(c->fc, AV_LOG_ERROR, "Invalid edit list entry_count: %d for elst atom of size: %"PRId64" bytes.\n",
5687 edit_count, atom.size + 8);
5690 edit_count = atom.size / elst_entry_size;
5691 if (edit_count * elst_entry_size != atom.size) {
5692 av_log(c->fc, AV_LOG_WARNING, "ELST atom of %"PRId64" bytes, bigger than %d entries.\n", atom.size, edit_count);
5708 for (i = 0; i < edit_count && atom.size > 0 && !pb->eof_reached; i++) {
5714 atom.size -= 16;
5718 atom.size -= 8;
5721 atom.size -= 4;
5757 if (atom.size < 5) {
5802 if (atom.size < 5) {
5850 if (atom.size < 24 || sc->mastering) {
5886 if (atom.size < 5) {
5922 if (atom.size < 4) {
5955 if (atom.size < 5) {
5993 int size, version, layout;
6005 if (atom.size < 8) {
6010 size = avio_rb32(pb);
6011 if (size <= 12 || size > atom.size)
6026 avio_skip(pb, size - 12); /* metadata_source */
6028 size = avio_rb32(pb);
6029 if (size > atom.size)
6038 size = avio_rb32(pb);
6039 if (size > atom.size)
6060 size = avio_rb32(pb);
6061 if (size > atom.size)
6208 if (atom.size < AV_UUID_LEN || atom.size >= FFMIN(INT_MAX, SIZE_MAX))
6222 size_t len = atom.size - AV_UUID_LEN;
6262 size_t len = atom.size - AV_UUID_LEN;
6283 size_t len = atom.size - AV_UUID_LEN;
6299 if (atom.size < 8)
6302 ret = ffio_read_size(pb, content, FFMIN(sizeof(content), atom.size));
6585 * memory if the file contains an invalid/malicious size value.
6587 static int mov_try_read_block(AVIOContext *pb, size_t size, uint8_t **data)
6592 while (offset < size) {
6596 unsigned int to_read = FFMIN(size, alloc_size) - offset;
6841 (atom.size > (AV_DRM_MAX_DRM_PSSH_LEN - MOV_DRM_PSSH_TITLE_LEN)) || (atom.size == 0)) {
6847 AV_WB32(pssh_buf, (atom.size + MOV_DRM_PSSH_TITLE_LEN));
6850 if ((ret = ffio_read_size(pb, pssh_buf + MOV_DRM_PSSH_TITLE_LEN, atom.size)) < 0) {
6854 if ((ret = mov_set_drm_info(pssh_buf, (uint32_t)(atom.size + MOV_DRM_PSSH_TITLE_LEN), &side_data_node)) != 0) {
7001 if (atom.size < 8)
7040 if (atom.size < 20)
7064 av_log(c->fc, AV_LOG_ERROR, "invalid per-sample IV size value\n");
7091 int last, type, size, ret;
7098 if ((uint64_t)atom.size > (1<<30) || atom.size < 42)
7111 flac_parse_block_header(buf, &last, &type, &size);
7113 if (type != FLAC_METADATA_TYPE_STREAMINFO || size != FLAC_STREAMINFO_SIZE) {
7118 ret = ff_get_extradata(c->fc, st->codecpar, pb, size);
7128 static int cenc_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
7150 av_aes_ctr_crypt(sc->cenc.aes_ctr, input, input, size);
7155 if (sample->subsamples[i].bytes_of_clear_data + sample->subsamples[i].bytes_of_protected_data > size) {
7156 av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
7162 size -= sample->subsamples[i].bytes_of_clear_data;
7170 size -= bytes_of_protected_data;
7173 if (size > 0) {
7181 static int cbc1_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
7205 av_aes_crypt(sc->cenc.aes_ctx, input, input, size/16, iv, 1);
7210 if (sample->subsamples[i].bytes_of_clear_data + sample->subsamples[i].bytes_of_protected_data > size) {
7211 av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
7222 size -= sample->subsamples[i].bytes_of_clear_data;
7230 size -= sample->subsamples[i].bytes_of_protected_data;
7233 if (size > 0) {
7241 static int cens_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
7264 av_aes_ctr_crypt(sc->cenc.aes_ctr, input, input, size);
7272 if (sample->subsamples[i].bytes_of_clear_data + sample->subsamples[i].bytes_of_protected_data > size) {
7273 av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
7279 size -= sample->subsamples[i].bytes_of_clear_data;
7295 size -= sample->subsamples[i].bytes_of_protected_data;
7298 if (size > 0) {
7306 static int cbcs_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
7329 av_aes_crypt(sc->cenc.aes_ctx, input, input, size/16, iv, 1);
7337 if (sample->subsamples[i].bytes_of_clear_data + sample->subsamples[i].bytes_of_protected_data > size) {
7338 av_log(c->fc, AV_LOG_ERROR, "subsample size exceeds the packet size left\n");
7344 size -= sample->subsamples[i].bytes_of_clear_data;
7361 size -= sample->subsamples[i].bytes_of_protected_data;
7364 if (size > 0) {
7372 static int cenc_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
7375 return cenc_scheme_decrypt(c, sc, sample, input, size);
7377 return cbc1_scheme_decrypt(c, sc, sample, input, size);
7379 return cens_scheme_decrypt(c, sc, sample, input, size);
7381 return cbcs_scheme_decrypt(c, sc, sample, input, size);
7438 return cenc_decrypt(mov, sc, encrypted_sample, pkt->data, pkt->size);
7440 size_t size;
7443 side_data = av_encryption_info_add_side_data_ex(encrypted_sample, &size, side_data, pkt->size);
7445 uint8_t *side_data = av_encryption_info_add_side_data(encrypted_sample, &size);
7450 ret = av_packet_add_side_data(pkt, AV_PKT_DATA_ENCRYPTION_INFO, (uint8_t *)side_data, size);
7452 ret = av_packet_add_side_data(pkt, AV_PKT_DATA_ENCRYPTION_INFO, side_data, size);
7468 size_t size;
7475 if ((uint64_t)atom.size > (1<<30) || atom.size < 11)
7484 /* OpusSpecificBox size plus magic for Ogg OpusHead header. */
7485 size = atom.size + 8;
7487 if ((ret = ff_alloc_extradata(st->codecpar, size)) < 0)
7493 avio_read(pb, st->codecpar->extradata + 9, size - 9);
7524 if (atom.size < 10)
7552 int64_t read_size = atom.size;
7574 int64_t size = atom.size;
7576 if (atom.size < 6)
7586 size -= 4;
7599 size)) < 0) {
7604 if (scheme_str_len + 1 >= size) {
7606 // we check with + 1 since we expect that if size was not hit,
7612 size -= scheme_str_len + 1;
7615 size)) < 0) {
7620 if (value_str_len == size) {
7667 if (atom.size < 16) {
7734 if (atom.size < 5) {
7750 static int rb_size(AVIOContext *pb, uint64_t* value, int size)
7752 if (size == 0)
7754 else if (size == 1)
7756 else if (size == 2)
7758 else if (size == 4)
7760 else if (size == 8)
7764 return size;
7771 return atom.size;
7889 return atom.size;
7897 if (atom.size > 0) {
7898 if (atom.size > FFMIN(INT_MAX, SIZE_MAX - 1))
7900 char* genre = av_mallocz(atom.size + 1); /* Add null terminator */
7904 int ret = ffio_read_size(pb, genre, atom.size);
7910 for (i = 0; i < atom.size; ++i) {
7967 { MKTAG('s','t','s','z'), mov_read_stsz }, /* sample size */
7969 { MKTAG('s','t','z','2'), mov_read_stsz }, /* compact sample size */
8052 if (atom.size < 0)
8053 atom.size = INT64_MAX;
8054 while (total_size <= atom.size - 8) {
8056 a.size = avio_rb32(pb);
8062 a.size >= 8 &&
8087 if (a.size == 1 && total_size + 8 <= atom.size) { /* 64 bit extended size */
8088 a.size = avio_rb64(pb) - 8;
8092 av_fourcc2str(a.type), av_fourcc2str(atom.type), a.size, total_size, atom.size);
8093 if (a.size == 0) {
8094 a.size = atom.size - total_size + 8;
8096 if (a.size < 0)
8098 a.size -= 8;
8099 if (a.size < 0)
8101 a.size = FFMIN(a.size, atom.size - total_size);
8131 avio_skip(pb, a.size);
8140 if (c->found_moov && c->found_mdat && a.size <= INT64_MAX - start_pos &&
8142 start_pos + a.size == avio_size(pb))) {
8144 c->next_root_atom = start_pos + a.size;
8148 left = a.size - avio_tell(pb) + start_pos;
8159 total_size += a.size;
8162 if (total_size < atom.size && atom.size < 0x7ffff)
8163 avio_skip(pb, atom.size - total_size);
8179 int64_t size;
8184 size = AV_RB32(p->buf + offset);
8185 if (size == 1 && offset + 16 <= (unsigned int)p->buf_size) {
8186 size = AV_RB64(p->buf+offset + 8);
8188 } else if (size == 0) {
8189 size = p->buf_size - offset;
8191 if (size < minsize) {
8230 if (size > INT64_MAX - offset)
8232 offset += size;
8297 if (ff_add_attached_pic(s, st, sc->pb, NULL, sample->size) < 0)
8323 if (len > sample->size-2)
8593 uint32_t size = avio_rb32(f);
8640 avio_seek(f, pos + size, SEEK_SET);
8657 av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (unreasonable size)\n");
8665 av_log(c->fc, AV_LOG_DEBUG, "doesn't look like mfra (size mismatch)\n");
8708 atom.size = avio_size(pb);
8710 atom.size = INT64_MAX;
8994 static int get_eia608_packet(AVIOContext *pb, AVPacket *pkt, int size)
8998 if (size <= 8)
9000 new_size = ((size - 8) / 2) * 3;
9040 sample->size = FFMIN(sample->size, (mov->next_root_atom - sample->pos));
9061 if (st->codecpar->codec_id == AV_CODEC_ID_EIA_608 && sample->size > 8)
9062 ret = get_eia608_packet(sc->pb, pkt, sample->size);
9064 ret = av_get_packet(sc->pb, pkt, sample->size);
9073 if (pkt->size >= 8) {
9075 int payload_size = pkt->size - 8;
9077 pkt->size = 0;
9087 if (pkt->size < move_size) {
9088 move_size = pkt->size;
9091 pkt->size = payload_size;
9092 pkt->data[pkt->size] = '\0';
9108 ret = avpriv_dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos);
9128 if (st->codecpar->codec_id == AV_CODEC_ID_MP3 && !ffstream(st)->need_parsing && pkt->size > 4) {
9186 aax_filter(pkt->data, pkt->size, mov);