libtiff/backport-CVE-2023-2731.patch
zhangpan 625960b341 fix CVE-2023-2731
(cherry picked from commit a194ef6e717d1e13f7b283ecc3e5d63e2b9fa5bc)
2023-05-26 17:22:55 +08:00

38 lines
1.2 KiB
Diff

From 9be22b639ea69e102d3847dca4c53ef025e9527b Mon Sep 17 00:00:00 2001
From: Even Rouault <even.rouault@spatialys.com>
Date: Sat, 29 Apr 2023 12:20:46 +0200
Subject: [PATCH] LZWDecode(): avoid crash when trying to read again from a
strip whith a missing end-of-information marker (fixes #548)
Reference:https://github.com/libsdl-org/libtiff/commit/9be22b639ea69e102d3847dca4c53ef025e9527b
Conflict:Adaptation Context
---
libtiff/tif_lzw.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libtiff/tif_lzw.c b/libtiff/tif_lzw.c
index 1f255d9..c0ef99c 100644
--- a/libtiff/tif_lzw.c
+++ b/libtiff/tif_lzw.c
@@ -404,6 +404,10 @@ LZWDecode(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s)
assert(sp->dec_codetab != NULL);
if (sp->read_error) {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "LZWDecode: Scanline %" PRIu32 " cannot be read due to "
+ "previous error",
+ tif->tif_row);
return 0;
}
@@ -712,6 +716,7 @@ after_loop:
return (1);
no_eoi:
+ sp->read_error = 1;
TIFFErrorExt(tif->tif_clientdata, module,
"LZWDecode: Strip %"PRIu32" not terminated with EOI code",
tif->tif_curstrip);
--
2.33.0