CVE-2022-32978 (published 2022-06-10T15:15Z)

There is an assertion failure in SingleComponentLSScan::ParseMCU in singlecomponentlsscan.cpp in libjpeg before 1.64 via an empty JPEG-LS scan.

Severity: MEDIUM
CVSS v2 base score: 4.3 (AV:N/AC:M/Au:N/C:N/I:N/A:P)
CVSS v3 base score: 6.5, MEDIUM (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H)

Weakness information:
cwe_id: CWE-617
cwe_name: Reachable Assertion
description: The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.
extended_description: 
            While assertion is good for catching logic errors and reducing the chances of reaching more serious vulnerability conditions, it can still lead to a denial of service.
            For example, if a server handles multiple simultaneous connections, and an assert() occurs in one single connection that causes all other connections to be dropped, this is a reachable assertion that leads to a denial of service.
         
         

Fix information:
repo_url: https://github.com/thorfdbg/libjpeg
commit_details: repo_url: https://github.com/thorfdbg/libjpeg
author: Thomas Richter
author_date: 2022-06-08 12:58:05+02:00
msg: Fixed handling of empty JPEG-LS scans.
repository: repo_url: https://github.com/thorfdbg/libjpeg
repo_name: thorfdbg/libjpeg
description: A complete implementation of 10918-1 (JPEG) coming from jpeg.org (the ISO group) with extensions for HDR, lossless and alpha channel coding standardized as ISO/IEC 18477 (JPEG XT).
repo_language: C++
owner: thorfdbg
file_changes: filename: README
change_type: ModificationType.MODIFY
diff: @@ -40,7 +40,7 @@ Standard JPEG compression, with 444 (aka "no") subsampling:
 
 $ jpeg -q <quality> infile.ppm outfile.jpg
 
-Standard JPEG compression, with 422 subsampling:
+Standard JPEG compression, with 420 subsampling:
 
 $ jpeg -q <quality> -s 1x1,2x2,2x2 infile.ppm outfile.jpg
 

programming_language: Markdown
filename: sampleinterleavedlsscan.cpp
change_type: ModificationType.MODIFY
diff: @@ -42,7 +42,7 @@
 ** A JPEG LS scan interleaving samples of several components,
 ** sample by sample.
 **
-** $Id: sampleinterleavedlsscan.cpp,v 1.15 2014/11/14 15:41:32 thor Exp $
+** $Id: sampleinterleavedlsscan.cpp,v 1.16 2022/06/08 10:54:55 thor Exp $
 **
 */
 
@@ -112,9 +112,12 @@ bool SampleInterleavedLSScan::ParseMCU(void)
   if (lines > 8) {
     lines = 8;
   }
+
+  if (lines == 0)
+    return false;
+  
   if (m_pFrame->HeightOf() > 0)
     m_ulRemaining[0] -= lines;
-  assert(lines > 0);
   assert(m_ucCount < 4);
 
   //

programming_language: C++
filename: singlecomponentlsscan.cpp
change_type: ModificationType.MODIFY
diff: @@ -41,7 +41,7 @@
 /*
 ** A JPEG LS scan covering only a single component.
 **
-** $Id: singlecomponentlsscan.cpp,v 1.18 2014/11/14 15:41:32 thor Exp $
+** $Id: singlecomponentlsscan.cpp,v 1.19 2022/06/08 10:54:55 thor Exp $
 **
 */
 
@@ -96,8 +96,9 @@ bool SingleComponentLSScan::ParseMCU(void)
   }
   if (m_pFrame->HeightOf() > 0)
     m_ulRemaining[0] -= lines;
-  
-  assert(lines > 0);
+
+  if (lines == 0)
+    return false;
 
   // Loop over lines and columns
   do {

programming_language: C++