cellRec: fix width of encoder frames

Turns out the pitch was accidentally used as width, leading to an out of bounds read/write.
I kept the pitch in the struct for completeness' sake. It may be needed later, if only for error checks.
This commit is contained in:
Megamouse 2023-08-12 23:06:22 +02:00
parent f40a6d496a
commit 39bbf17caf
12 changed files with 24 additions and 22 deletions

View file

@ -604,14 +604,14 @@ namespace utils
m_audio_codec_id = codec_id;
}
void video_encoder::add_frame(std::vector<u8>& frame, const u32 width, const u32 height, s32 pixel_format, usz timestamp_ms)
void video_encoder::add_frame(std::vector<u8>& frame, u32 pitch, u32 width, u32 height, s32 pixel_format, usz timestamp_ms)
{
// Do not allow new frames while flushing
if (m_flush)
return;
std::lock_guard lock(m_mtx);
m_frames_to_encode.emplace_back(timestamp_ms, width, height, pixel_format, std::move(frame));
m_frames_to_encode.emplace_back(timestamp_ms, pitch, width, height, pixel_format, std::move(frame));
}
void video_encoder::pause(bool flush)