changeset 370:8700cc322c0c stable-0-6-70

Jeffrey Morlan - pst_getID2 must not recurse into children
author Carl Byington <carl@five-ten-sg.com>
date Wed, 08 Feb 2017 20:43:16 -0800
parents 5bd56ffe0759
children c02339879041
files ChangeLog NEWS configure.in libpst.spec.in regression/regression-tests.bash src/libpst.c
diffstat 6 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Oct 29 17:45:29 2016 -0700
+++ b/ChangeLog	Wed Feb 08 20:43:16 2017 -0800
@@ -1,3 +1,7 @@
+LibPST 0.6.70 (2017-02-08)
+===============================
+    * Jeffrey Morlan - pst_getID2 must not recurse into children
+
 LibPST 0.6.69 (2016-10-29)
 ===============================
     * fix bugs in code allowing folders containing multiple item types
--- a/NEWS	Sat Oct 29 17:45:29 2016 -0700
+++ b/NEWS	Wed Feb 08 20:43:16 2017 -0800
@@ -1,3 +1,4 @@
+0.6.70  2017-02-08 Jeffrey Morlan - pst_getID2 must not recurse into children
 0.6.69  2016-10-29 fix bugs in code allowing folders containing multiple item types
 0.6.68  2016-08-29 allow folders containing multiple item types;  better detection of valid internet headers
 0.6.67  2016-07-06 Jeffrey Morlan - multiple bug fixes and an optimization
--- a/configure.in	Sat Oct 29 17:45:29 2016 -0700
+++ b/configure.in	Wed Feb 08 20:43:16 2017 -0800
@@ -1,5 +1,5 @@
 AC_PREREQ(2.60)
-AC_INIT(libpst,0.6.69,carl@five-ten-sg.com)
+AC_INIT(libpst,0.6.70,carl@five-ten-sg.com)
 AC_CONFIG_SRCDIR([src/libpst.c])
 AC_CONFIG_HEADER([config.h])
 AC_CONFIG_MACRO_DIR([m4])
--- a/libpst.spec.in	Sat Oct 29 17:45:29 2016 -0700
+++ b/libpst.spec.in	Wed Feb 08 20:43:16 2017 -0800
@@ -160,6 +160,12 @@
 
 
 %changelog
+* Wed Feb 08 2017 Carl Byington <carl@five-ten-sg.com> 0.6.70-1
+- Jeffrey Morlan - pst_getID2 must not recurse into children
+
+* Fri Jan 27 2017 Jonathan Wakely <jwakely@redhat.com> - 0.6.69-2
+- Rebuilt for Boost 1.63
+
 * Sat Oct 29 2016 Carl Byington <carl@five-ten-sg.com> 0.6.69-1
 - fix bugs in code allowing folders containing multiple item types
 
--- a/regression/regression-tests.bash	Sat Oct 29 17:45:29 2016 -0700
+++ b/regression/regression-tests.bash	Wed Feb 08 20:43:16 2017 -0800
@@ -138,6 +138,7 @@
 $func  14 joe.romanowski.pst
 $func  15 hourig1.pst
 $func  16 test-mac.pst
+$func  17 backup.pst
 $func  18 spam.pst
 $func  19 rendgen.pst           # single email appointment
 $func  20 rendgen2.pst          # email appointment with no termination date
--- a/src/libpst.c	Sat Oct 29 17:45:29 2016 -0700
+++ b/src/libpst.c	Wed Feb 08 20:43:16 2017 -0800
@@ -1242,7 +1242,7 @@
     if ((id2_ptr = pst_getID2(id2_head, (uint64_t)0x692))) {
         // DSN/MDN reports?
         DEBUG_INFO(("DSN/MDN processing\n"));
-        list = pst_parse_block(pf, id2_ptr->id->i_id, id2_head);
+        list = pst_parse_block(pf, id2_ptr->id->i_id, id2_ptr->child);
         if (list) {
             for (x=0; x < list->count_objects; x++) {
                 attach = (pst_item_attach*) pst_malloc(sizeof(pst_item_attach));
@@ -1269,7 +1269,7 @@
 
     if ((id2_ptr = pst_getID2(id2_head, (uint64_t)0x671))) {
         DEBUG_INFO(("ATTACHMENT processing attachment\n"));
-        list = pst_parse_block(pf, id2_ptr->id->i_id, id2_head);
+        list = pst_parse_block(pf, id2_ptr->id->i_id, id2_ptr->child);
         if (!list) {
             if (item->flags & PST_FLAG_HAS_ATTACHMENT) {
                 // Only report an error if we expected to see an attachment table and didn't.
@@ -1323,7 +1323,7 @@
                 pst_free_list(list);
                 // As per 2.4.6.2 in the spec, the attachment data is stored as a child of the
                 // attachment object, so we pass in id2_ptr as the head to search from.
-                id2_ptr = pst_getID2(id2_ptr, attach->id2_val);
+                id2_ptr = pst_getID2(id2_ptr->child, attach->id2_val);
                 if (id2_ptr) {
                     DEBUG_WARN(("second pass attachment updating id2 %#"PRIx64" found i_id %#"PRIx64"\n", attach->id2_val, id2_ptr->id->i_id));
                     // i_id has been updated to the datablock containing the attachment data
@@ -3637,18 +3637,14 @@
 
 
 static pst_id2_tree *pst_getID2(pst_id2_tree *head, uint64_t id2) {
+    // the id2 values are only unique among siblings.
+    // we must not recurse into children
+    // the caller must supply the correct parent
     DEBUG_ENT("pst_getID2");
     DEBUG_INFO(("looking for id2 = %#"PRIx64"\n", id2));
     pst_id2_tree *ptr = head;
     while (ptr) {
         if (ptr->id2 == id2) break;
-        if (ptr->child) {
-            pst_id2_tree *rc = pst_getID2(ptr->child, id2);
-            if (rc) {
-                DEBUG_RET();
-                return rc;
-            }
-        }
         ptr = ptr->next;
     }
     if (ptr && ptr->id) {