From: Mathieu Malaterre <mathieu.malaterre@gmail.com>
Date: Mon, 29 Jun 2026 15:02:10 +0200
Subject: [PATCH] Accepth odd length

Fix regression f0e359c87947326c7fb2f7b91ecbe351e9d8c683

The frame size check added by CVE-2025-53618_CVE-2025-53619.patch
rejects a frame that carries the one byte of padding DICOM adds to
odd-length values, so JPEG encoding (for example gdcmconv --jpeg)
fails on images such as a 3x3 RGB one.

Origin: upstream, https://github.com/malaterre/GDCM/commit/9ced0f9ae1d6ecb9e84c2a06db36c9697815108f
Applied-Upstream: 3.2.9
Last-Update: 2026-11-01
---
--- a/Source/MediaStorageAndFileFormat/gdcmJPEGBITSCodec.hxx
+++ b/Source/MediaStorageAndFileFormat/gdcmJPEGBITSCodec.hxx
@@ -1171,7 +1171,7 @@ bool JPEGBITSCodec::InternalCode(const c
   // Check if provided buffer correspond to image parameters for current frame
   size_t expected_frame_size = (size_t)image_width * image_height *
                                this->GetPixelFormat().GetPixelSize();
-  if (len != expected_frame_size) {
+  if (len != expected_frame_size && len != expected_frame_size + 1) {
     gdcmErrorMacro("Frame size don't match");
     return false;
   }
