summaryrefslogtreecommitdiff
path: root/repo/djvulibre/djvulibre-3.5.27-djvuport-stack-overflow.patch
diff options
context:
space:
mode:
Diffstat (limited to 'repo/djvulibre/djvulibre-3.5.27-djvuport-stack-overflow.patch')
-rw-r--r--repo/djvulibre/djvulibre-3.5.27-djvuport-stack-overflow.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/repo/djvulibre/djvulibre-3.5.27-djvuport-stack-overflow.patch b/repo/djvulibre/djvulibre-3.5.27-djvuport-stack-overflow.patch
new file mode 100644
index 0000000..e7bc643
--- /dev/null
+++ b/repo/djvulibre/djvulibre-3.5.27-djvuport-stack-overflow.patch
@@ -0,0 +1,36 @@
+diff --git a/libdjvu/DjVuPort.cpp b/libdjvu/DjVuPort.cpp
+index 2b3e0d2..ede7f6b 100644
+--- a/libdjvu/DjVuPort.cpp
++++ b/libdjvu/DjVuPort.cpp
+@@ -507,10 +507,19 @@ GP<DjVuFile>
+ DjVuPortcaster::id_to_file(const DjVuPort * source, const GUTF8String &id)
+ {
+ GPList<DjVuPort> list;
++
++ if (!!opening_id && opening_id == id)
++ G_THROW("DjVuPortcaster: recursive opening of the same file (corrupted file?)");
++ else
++ opening_id = id;
++
+ compute_closure(source, list, true);
+ GP<DjVuFile> file;
+ for(GPosition pos=list;pos;++pos)
+ if ((file=list[pos]->id_to_file(source, id))) break;
++
++ opening_id = GUTF8String();
++
+ return file;
+ }
+
+diff --git a/libdjvu/DjVuPort.h b/libdjvu/DjVuPort.h
+index e2b3125..313dc2b 100644
+--- a/libdjvu/DjVuPort.h
++++ b/libdjvu/DjVuPort.h
+@@ -484,6 +484,7 @@ private:
+ const DjVuPort *dst, int distance);
+ void compute_closure(const DjVuPort *src, GPList<DjVuPort> &list,
+ bool sorted=false);
++ GUTF8String opening_id;
+ };
+
+