Patchwork [1,of,3,V2] lazymanifest: fail if path or hash strings cannot be created

login
register
mail settings
Submitter Martin von Zweigbergk
Date March 12, 2015, 11:14 p.m.
Message ID <c13f6aa77c70ecb227cc.1426202072@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/8034/
State Accepted
Commit 30e9ee2038462725f706e14819a799ceedefcb71
Headers show

Comments

Martin von Zweigbergk - March 12, 2015, 11:14 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1426106134 25200
#      Wed Mar 11 13:35:34 2015 -0700
# Node ID c13f6aa77c70ecb227cca08d9221de0492ff0848
# Parent  b7add2ebef9e41b91a1cd16a0cf149f517527cf0
lazymanifest: fail if path or hash strings cannot be created

While generating (path, hash, flags), we fail if flags cannot be
created. We should also fail if path or hash cannot be created.

Patch

diff -r b7add2ebef9e -r c13f6aa77c70 mercurial/manifest.c
--- a/mercurial/manifest.c	Wed Mar 11 08:28:56 2015 -0700
+++ b/mercurial/manifest.c	Wed Mar 11 13:35:34 2015 -0700
@@ -243,7 +243,7 @@ 
 	consumed = pl + 41;
 	flags = PyString_FromStringAndSize(l->start + consumed,
 									   l->len - consumed - 1);
-	if (!flags) {
+	if (!path || !hash || !flags) {
 		goto bail;
 	}
 	ret = PyTuple_Pack(3, path, hash, flags);