djvulibre/fix-stack-overflow-in-process_incl_chunk.patch
herengui f554df1917 fix stack-overflow in process_incl_chunk
Signed-off-by: herengui <herengui@uniontech.com>
2022-02-07 10:31:17 +08:00

28 lines
723 B
Diff

From dddf5d485e534c1f70d795ff37a0b2dba42e442a Mon Sep 17 00:00:00 2001
From: herengui <herengui@uniontech.com>
Date: Mon, 7 Feb 2022 10:26:11 +0800
Subject: [PATCH] fix stack-overflow in process_incl_chunk
Signed-off-by: herengui <herengui@uniontech.com>
---
libdjvu/DjVuFile.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libdjvu/DjVuFile.cpp b/libdjvu/DjVuFile.cpp
index d5be2e5..e9deef9 100644
--- a/libdjvu/DjVuFile.cpp
+++ b/libdjvu/DjVuFile.cpp
@@ -566,6 +566,9 @@ DjVuFile::process_incl_chunk(ByteStream & str, int file_num)
incl_str.setat(incl_str.length()-1, 0);
}
+ if (!incl_str.is_valid())
+ return 0;
+
if (incl_str.length()>0)
{
if (strchr(incl_str, '/'))
--
2.20.1