From 4256a66d09b3e681f6fc9f74f5ddaeafa0135a56 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Sat, 7 Nov 2026 07:39:14 -0400 Subject: [PATCH] [Fix] (MG_Impl/Pipe): zero the pixel pack record's padding before it is sent --- MobileGL/MG_Impl/Pipe/PipeFill.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/MobileGL/MG_Impl/Pipe/PipeFill.cpp b/MobileGL/MG_Impl/Pipe/PipeFill.cpp index b26dd6ca..032c50e1 100644 --- a/MobileGL/MG_Impl/Pipe/PipeFill.cpp +++ b/MobileGL/MG_Impl/Pipe/PipeFill.cpp @@ -2602,8 +2602,20 @@ namespace MobileGL::MG_Pipe { // boundary reads unpack state, and the staged-repack upload path does not even issue // glPixelStorei (ARCHITECTURE.md 4.6 D5). Uint64 EmitPixelPackState(GLContext& ctx) { - MGPPixelPackState pack{}; - pack.Pack = ctx.GetPixelStoreParameters(false); + // Field by field into zeroed bytes: the two bytes of padding after the Bools would + // otherwise carry whatever the context's heap block held, onto the wire and into the + // recorder's hash. + MGPPixelPackState pack; + std::memset(&pack, 0, sizeof(pack)); + const PixelStoreParameters live = ctx.GetPixelStoreParameters(false); + pack.Pack.SwapBytes = live.SwapBytes; + pack.Pack.LSBFirst = live.LSBFirst; + pack.Pack.RowLength = live.RowLength; + pack.Pack.ImageHeight = live.ImageHeight; + pack.Pack.SkipPixels = live.SkipPixels; + pack.Pack.SkipRows = live.SkipRows; + pack.Pack.SkipImages = live.SkipImages; + pack.Pack.Alignment = live.Alignment; MGPipeRouteSetPixelPackState(pack); return sizeof(MGPPixelPackState); }