Copy pointers to AVPicture after memory has been allocated. Fixes NULL pointers in AVPicture after a17a7661906ba295d67afd80ac0770422e1b02b3.
Unified · Split
| @@ -543,16 +543,6 @@ static int display_end_segment(AVCodecContext *avctx, void *data, · 542 unmodified lines | ||
| 543 | 543 | |
| 544 | 544 | sub->rects[i]->linesize[0] = object->w; |
| 545 | 545 | |
| 546 | −#if FF_API_AVPICTURE | |
| 547 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 548 | − rect = sub->rects[i]; | |
| 549 | − for (j = 0; j < 4; j++) { | |
| 550 | − rect->pict.data[j] = rect->data[j]; | |
| 551 | − rect->pict.linesize[j] = rect->linesize[j]; | |
| 552 | − } | |
| 553 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 554 | −#endif | |
| 555 | − | |
| 556 | 546 | if (object->rle) { |
| 557 | 547 | if (object->rle_remaining_len) { |
| 558 | 548 | av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n", |
| @@ -582,6 +572,16 @@ FF_ENABLE_DEPRECATION_WARNINGS · 23 unmodified lines | ||
| 582 | 572 | return AVERROR(ENOMEM); |
| 583 | 573 | } |
| 584 | 574 | |
| 575 | +#if FF_API_AVPICTURE | |
| 576 | +FF_DISABLE_DEPRECATION_WARNINGS | |
| 577 | + rect = sub->rects[i]; | |
| 578 | + for (j = 0; j < 4; j++) { | |
| 579 | + rect->pict.data[j] = rect->data[j]; | |
| 580 | + rect->pict.linesize[j] = rect->linesize[j]; | |
| 581 | + } | |
| 582 | +FF_ENABLE_DEPRECATION_WARNINGS | |
| 583 | +#endif | |
| 584 | + | |
| 585 | 585 | memcpy(sub->rects[i]->data[1], palette->clut, sub->rects[i]->nb_colors * sizeof(uint32_t)); |
| 586 | 586 | |
| 587 | 587 | } |