You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LibRaw/SOURCES/LibRaw-CVE-2021-32142.patch

42 lines
1.2 KiB

From 85e018cbca5eb3743eddca91d3d40c3123fa9777 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Tue, 19 Sep 2023 19:52:40 +0200
Subject: [PATCH] check for input buffer size on datastream::gets
(backported from commit fa329f37dca4a2c938f8abb50ee4a7ef93e64fbb)
---
src/libraw_datastream.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/libraw_datastream.cpp b/src/libraw_datastream.cpp
index bd9cf5ee55d7..aecd3997a707 100644
--- a/src/libraw_datastream.cpp
+++ b/src/libraw_datastream.cpp
@@ -175,6 +175,7 @@ INT64 LibRaw_file_datastream::tell()
char *LibRaw_file_datastream::gets(char *str, int sz)
{
+ if(sz<1) return NULL;
if (substream)
return substream->gets(str, sz);
LR_STREAM_CHK();
@@ -398,6 +399,7 @@ INT64 LibRaw_buffer_datastream::tell()
char *LibRaw_buffer_datastream::gets(char *s, int sz)
{
+ if(sz<1) return NULL;
if (substream)
return substream->gets(s, sz);
unsigned char *psrc, *pdest, *str;
@@ -594,6 +596,7 @@ INT64 LibRaw_bigfile_datastream::tell()
char *LibRaw_bigfile_datastream::gets(char *str, int sz)
{
+ if(sz<1) return NULL;
LR_BF_CHK();
return substream ? substream->gets(str, sz) : fgets(str, sz, f);
}
--
2.41.0