{"thread":{"id":"12094","subject":"[PATCH 1/5] fast-import: check return value from unpack_entry()","startedAt":"2008-02-14T06:34:34Z","lastAt":"2008-02-14T06:34:34Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"68716","messageId":"20080214063434.GA30678@spearce.org","threadId":"12094","inReplyTo":null,"subject":"[PATCH 1/5] fast-import: check return value from unpack_entry()","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-02-14T06:34:34Z","receivedAt":"2008-02-14T06:34:34Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If the tree object we have asked for is deltafied in the packfile and\nthe delta did not apply correctly or was not able to be decompressed\nfrom the packfile then we can get back NULL instead of the tree data.\nThis is (part of) the reason why read_sha1_file() can return NULL, so\nwe need to also handle it the same way.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n fast-import.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/fast-import.c b/fast-import.c\nindex a523b17..9b71ccc 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1204,6 +1204,8 @@ static void load_tree(struct tree_entry *root)\n \t\t\tdie(\"Not a tree: %s\", sha1_to_hex(sha1));\n \t\tt->delta_depth = myoe->depth;\n \t\tbuf = gfi_unpack_entry(myoe, &size);\n+\t\tif (!buf)\n+\t\t\tdie(\"Can't load tree %s\", sha1_to_hex(sha1));\n \t} else {\n \t\tenum object_type type;\n \t\tbuf = read_sha1_file(sha1, &type, &size);\n-- \n1.5.4.1.1309.g833c2\n"}]}