diff src/libpst.c @ 355:d1f930be4711

From Jeffrey Morlan: pst_build_id_ptr and pst_build_desc_ptr require that the first child of a BTree page have the same starting ID as itself. This is not required by the spec, and is not true in many real-world PSTs (presumably, the original first child of the page got deleted). Because of this, many emails are not being extracted from these PSTs. It also triggers an infinite loop in lspst (a separate bug, also fixed)
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Jul 2016 10:12:22 -0700
parents 843705c25b45
children fec7f4fca713
line wrap: on
line diff
--- a/src/libpst.c	Tue Dec 22 08:59:46 2015 -0800
+++ b/src/libpst.c	Wed Jul 06 10:12:22 2016 -0700
@@ -1043,14 +1043,6 @@
                 return -1;
             }
             old = index.id;
-            if (x == (int32_t)1) {   // first entry
-                if ((start_val) && (index.id != start_val)) {
-                    DEBUG_WARN(("This item isn't right. Must be corruption, or I got it wrong!\n"));
-                    if (buf) free(buf);
-                    DEBUG_RET();
-                    return -1;
-                }
-            }
             i_ptr = (pst_index_ll*) pst_malloc(sizeof(pst_index_ll));
             i_ptr->i_id   = index.id;
             i_ptr->offset = index.offset;
@@ -1083,14 +1075,6 @@
                 return -1;
             }
             old = table.start;
-            if (x == (int32_t)1) {  // first entry
-                if ((start_val) && (table.start != start_val)) {
-                    DEBUG_WARN(("This table isn't right. Must be corruption, or I got it wrong!\n"));
-                    if (buf) free(buf);
-                    DEBUG_RET();
-                    return -1;
-                }
-            }
             (void)pst_build_id_ptr(pf, table.offset, depth+1, table.u1, table.start, table2.start);
         }
     }
@@ -1157,14 +1141,6 @@
                 return -1;
             }
             old = desc_rec.d_id;
-            if (x == 0) {   // first entry
-                if (start_val && (desc_rec.d_id != start_val)) {
-                    DEBUG_WARN(("This item isn't right. Must be corruption, or I got it wrong!\n"));
-                    if (buf) free(buf);
-                    DEBUG_RET();
-                    return -1;
-                }
-            }
             DEBUG_INFO(("New Record %#"PRIx64" with parent %#x\n", desc_rec.d_id, desc_rec.parent_d_id));
             {
                 pst_desc_tree *d_ptr = (pst_desc_tree*) pst_malloc(sizeof(pst_desc_tree));
@@ -1202,14 +1178,6 @@
                 return -1;
             }
             old = table.start;
-            if (x == 0) {   // first entry
-                if (start_val && (table.start != start_val)) {
-                    DEBUG_WARN(("This table isn't right. Must be corruption, or I got it wrong!\n"));
-                    if (buf) free(buf);
-                    DEBUG_RET();
-                    return -1;
-                }
-            }
             (void)pst_build_desc_ptr(pf, table.offset, depth+1, table.u1, table.start, table2.start);
         }
     }