23092145 /usr/bin/lkbib dumps core during accessing empty index file due to malloc(0)
authorosayama <osamu.sayama@oracle.com>
Thu, 21 Jul 2016 21:07:53 -0700
changeset 6451 680395ed1e35
parent 6450 492d6d7286df
child 6454 dfa9a292557b
23092145 /usr/bin/lkbib dumps core during accessing empty index file due to malloc(0)
components/groff/patches/lkbib_core_empty.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/groff/patches/lkbib_core_empty.patch	Thu Jul 21 21:07:53 2016 -0700
@@ -0,0 +1,16 @@
+This patch comes from in-house and has been submitted upstream:
+https://savannah.gnu.org/bugs/?48433
+
+--- groff-1.22.3/src/libs/libbib/index.cpp.org	2014-11-04 17:38:35.183524522 +0900
++++ groff-1.22.3/src/libs/libbib/index.cpp	2016-07-07 09:41:11.572149218 +0900
+@@ -158,6 +158,10 @@
+   }
+   mtime = sb.st_mtime;
+   int size = int(sb.st_size);
++  if (size == 0) {
++    error("`%1' is an empty file", name);
++    return 0;
++  }
+   char *addr;
+   map_addr = mapread(fd, size);
+   if (map_addr) {