# HG changeset patch # User Sebastien Jodogne # Date 1625466801 -7200 # Node ID ff8aec4536de5ba06088b98daa5461f1ff7087a1 # Parent 79b03e3437bdeb48c3eeda1279cd62844259a96a Prevent transcoding of 1-bit images diff -r 79b03e3437bd -r ff8aec4536de NEWS --- a/NEWS Wed Jun 23 09:07:46 2021 +0200 +++ b/NEWS Mon Jul 05 08:33:21 2021 +0200 @@ -1,6 +1,8 @@ Pending changes in the mainline =============================== +* Prevent transcoding of 1-bit images + Version 1.3 (2021-06-14) ======================== diff -r 79b03e3437bd -r ff8aec4536de Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Wed Jun 23 09:07:46 2021 +0200 +++ b/Plugin/Plugin.cpp Mon Jul 05 08:33:21 2021 +0200 @@ -340,6 +340,13 @@ gdcm::TransferSyntax syntax(gdcm::TransferSyntax::GetTSType(allowedSyntaxes[i])); if (syntax.IsValid()) { + if (reader.GetImage().GetPixelFormat().GetBitsAllocated() == 1u) + { + // Prevent transcoding of 1-bit images, as this might crash GDCM + // https://groups.google.com/g/orthanc-users/c/xIwrkFRceuE/m/jwxy50djAQAJ + throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented, "Cannot transcode 1bit images"); + } + if (reader.GetImage().GetPixelFormat().GetBitsStored() == 16u && syntax == gdcm::TransferSyntax::JPEGExtendedProcess2_4) {