changeset 426:79921c6bb4e8 src

This is a heuristic to prevent segfaults when ifo->vts_pgcit->pgci_srp[ptt[i].pgcn-1].pgc is invalid but non-NULL. Patch by Fabian Keil #fk$fabiankeil%de^
author rathann
date Thu, 03 Oct 2013 22:21:29 +0000
parents 323e54a7f200
children c53e528905ec
files searching.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/searching.c	Thu Oct 03 22:19:25 2013 +0000
+++ b/searching.c	Thu Oct 03 22:21:29 2013 +0000
@@ -616,6 +616,10 @@
   length = 0;
   for(i=0; i<parts; i++) {
     uint32_t cellnr, endcellnr;
+    if (ifo->vts_pgcit->pgci_srp[ptt[i].pgcn-1].pgc_start_byte >= ifo->vts_pgcit->last_byte) {
+      printerr("PGC start out of bounds");
+      continue;
+    }
     pgc = ifo->vts_pgcit->pgci_srp[ptt[i].pgcn-1].pgc;
     if (pgc == NULL) {
       printerr("PGC missing.");