| @@ -177,7 +177,8 @@ static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB · 176 unmodified lines |
| 177 | size -= 2; | 177 | size -= 2; |
| 178 | | 178 | |
| 179 | if (cc_count && size >= cc_count * 3) { | 179 | if (cc_count && size >= cc_count * 3) { |
| 180 | const uint64_t new_size = (s->a53_caption_size + cc_count | 180 | int old_size = s->buf_ref ? s->buf_ref->size : 0; |
| | 181 | const uint64_t new_size = (old_size + cc_count |
| 181 | * UINT64_C(3)); | 182 | * UINT64_C(3)); |
| 182 | int i, ret; | 183 | int i, ret; |
| 183 | | 184 | |
| @@ -185,14 +186,14 @@ static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB · 1 unmodified line |
| 185 | return AVERROR(EINVAL); | 186 | return AVERROR(EINVAL); |
| 186 | | 187 | |
| 187 | /* Allow merging of the cc data from two fields. */ | 188 | /* Allow merging of the cc data from two fields. */ |
| 188 | ret = av_reallocp(&s->a53_caption, new_size); | 189 | ret = av_buffer_realloc(&s->buf_ref, new_size); |
| 189 | if (ret < 0) | 190 | if (ret < 0) |
| 190 | return ret; | 191 | return ret; |
| 191 | | 192 | |
| 192 | for (i = 0; i < cc_count; i++) { | 193 | for (i = 0; i < cc_count; i++) { |
| 193 | s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); | 194 | s->buf_ref->data[old_size++] = get_bits(gb, 8); |
| 194 | s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); | 195 | s->buf_ref->data[old_size++] = get_bits(gb, 8); |
| 195 | s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); | 196 | s->buf_ref->data[old_size++] = get_bits(gb, 8); |
| 196 | } | 197 | } |
| 197 | skip_bits(gb, 8); // marker_bits | 198 | skip_bits(gb, 8); // marker_bits |
| 198 | } | 199 | } |
| @@ -363,6 +364,5 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEI *s, · 164 unmodified lines |
| 363 | | 364 | |
| 364 | void ff_hevc_reset_sei(HEVCSEI *s) | 365 | void ff_hevc_reset_sei(HEVCSEI *s) |
| 365 | { | 366 | { |
| 366 | s->a53_caption.a53_caption_size = 0; | 367 | av_buffer_unref(&s->a53_caption.buf_ref); |
| 367 | av_freep(&s->a53_caption.a53_caption); | | |
| 368 | } | 368 | } |