1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

cellAdec: fix uninitialized default size of AVPacketHolder (#12077)

This commit is contained in:
Megamouse 2022-05-25 11:40:51 +02:00 committed by GitHub
parent 961d41d0bd
commit 88ee62be26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -456,19 +456,19 @@ public:
struct AVPacketHolder : AVPacket
{
AVPacketHolder(u32 size)
AVPacketHolder(u32 data_size)
{
av_init_packet(this);
if (size)
if (data_size)
{
data = static_cast<u8*>(av_calloc(1, size + AV_INPUT_BUFFER_PADDING_SIZE));
this->size = size + AV_INPUT_BUFFER_PADDING_SIZE;
this->data = static_cast<u8*>(av_calloc(1, data_size + AV_INPUT_BUFFER_PADDING_SIZE));
this->size = data_size + AV_INPUT_BUFFER_PADDING_SIZE;
}
else
{
data = nullptr;
size = 0;
this->data = nullptr;
this->size = 0;
}
}

View File

@ -324,8 +324,6 @@ namespace utils
}
// Prepare to read data
AVPacket packet;
av_init_packet(&packet);
av.frame = av_frame_alloc();
if (!av.frame)
{
@ -336,6 +334,9 @@ namespace utils
duration_ms = stream->duration / 1000;
AVPacket packet{};
av_init_packet(&packet);
// Iterate through frames
while (thread_ctrl::state() != thread_state::aborting && av_read_frame(av.format, &packet) >= 0)
{