From 6861bd8c24f2a8d1ca8cdcaed25a2a38c39f1b96 Mon Sep 17 00:00:00 2001 From: Calebsenm Date: Sat, 18 Jul 2026 15:24:15 -0500 Subject: [PATCH] fix(core): fix memory alignment bug causing crash on odd-sized images --- app/codec/frame.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/codec/frame.cpp b/app/codec/frame.cpp index 56fa0bbf35..c2f118a88a 100644 --- a/app/codec/frame.cpp +++ b/app/codec/frame.cpp @@ -90,9 +90,9 @@ FramePtr Frame::Interlace(FramePtr top, FramePtr bottom) int Frame::generate_linesize_bytes(int width, PixelFormat format, int channel_count) { - // Align to 32 bytes (not sure if this is necessary?) - return VideoParams::GetBytesPerPixel(format, channel_count) * - ((width + 31) & ~31); + // Calculate the raw bytes required for the image row and Align to a multiple of 4 bytes. + int row_bytes = VideoParams::GetBytesPerPixel(format, channel_count) * width; + return (row_bytes + 3) & ~3; } Color Frame::get_pixel(int x, int y) const