From 0603afda32003d603458c61c10352c80a019f3d6 Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Sat, 5 Nov 2022 10:50:05 +0900 Subject: [PATCH] jhead: Add patch for CVE-2021-34055 --- packages/jhead/CVE-2021-34055.patch | 109 ++++++++++++++++++++++++++++ packages/jhead/build.sh | 1 + 2 files changed, 110 insertions(+) create mode 100644 packages/jhead/CVE-2021-34055.patch diff --git a/packages/jhead/CVE-2021-34055.patch b/packages/jhead/CVE-2021-34055.patch new file mode 100644 index 0000000000..69c7bbe2d1 --- /dev/null +++ b/packages/jhead/CVE-2021-34055.patch @@ -0,0 +1,109 @@ +https://github.com/Matthias-Wandel/jhead/commit/f0a884210cc46830b176f71fd61569adc8f230a7 + +Diff for makefile is deleted as it seems to be irrelevant. + +From c761620767ae72e5d61c697a73de262aebe0b591 Mon Sep 17 00:00:00 2001 +From: matthias wandel +Date: Wed, 1 Sep 2021 18:59:15 -0300 +Subject: [PATCH] If exif header is complete garbage, don't keep it. Fixes + issue 36 + +--- + exif.c | 12 +++++++----- + jhead.h | 2 +- + jpgfile.c | 5 ++++- + makefile | 8 +++++--- + 4 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/exif.c b/exif.c +index f805b8f..2057acd 100644 +--- a/exif.c ++++ b/exif.c +@@ -1005,7 +1005,7 @@ void Clear_EXIF () + // Process a EXIF marker + // Describes all the drivel that most digital cameras include... + //-------------------------------------------------------------------------- +-void process_EXIF (unsigned char * ExifSection, int length) ++int process_EXIF (unsigned char * ExifSection, int length) + { + int FirstOffset; + +@@ -1020,7 +1020,7 @@ void process_EXIF (unsigned char * ExifSection, int length) + static uchar ExifHeader[] = "Exif\0\0"; + if (memcmp(ExifSection+2, ExifHeader,6)){ + ErrNonfatal("Incorrect Exif header",0,0); +- return; ++ return 0; + } + } + +@@ -1033,21 +1033,21 @@ void process_EXIF (unsigned char * ExifSection, int length) + MotorolaOrder = 1; + }else{ + ErrNonfatal("Invalid Exif alignment marker.",0,0); +- return; ++ return 0; + } + } + + // Check the next value for correctness. + if (Get16u(ExifSection+10) != 0x2a){ + ErrNonfatal("Invalid Exif start (1)",0,0); +- return; ++ return 0; + } + + FirstOffset = (int)Get32u(ExifSection+12); + if (FirstOffset < 8 || FirstOffset > 16){ + if (FirstOffset < 16 || FirstOffset > length-16 || length < 16){ + ErrNonfatal("invalid offset for first Exif IFD value",0,0); +- return; ++ return 0; + } + // Usually set to 8, but other values valid too. + ErrNonfatal("Suspicious offset of first Exif IFD value",0,0); +@@ -1087,6 +1087,7 @@ void process_EXIF (unsigned char * ExifSection, int length) + ImageInfo.FocalLength35mmEquiv = (int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*36 + 0.5); + } + } ++ return 1; + } + + +@@ -1236,6 +1237,7 @@ void create_EXIF(void) + const char * ClearOrientation(void) + { + int a; ++ + if (NumOrientations == 0) return NULL; + + for (a=0;a