summaryrefslogtreecommitdiff
blob: 4b51ce95bc1ab486d0e8c8b3ce94525186642a85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
removeEmptyLines() segfaults on empty string

https://bugs.gentoo.org/show_bug.cgi?id=454348
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676423

Patch written by Thibaut Paumard <paumard@users.sourceforge.net>
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -1022,6 +1022,11 @@
 static QCString removeEmptyLines(const QCString &s)
 {
   BufStr out(s.length()+1);
+  if (s.length()==0)
+  {
+    out.addChar('\0');
+    return out.data();
+  }
   char *p=s.data();
   if (p)
   {