Commit e9b2e4343f636d0cdb030ffe6ec1edc76d344253

Edward Thomson 2018-08-09T09:30:36

Merge pull request #4761 from pks-t/pks/aix-diff-oom diff: fix OOM on AIX when finding similar deltas in empty diff

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 7133065..42da150 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -822,7 +822,7 @@ int git_diff_find_similar(
 	num_deltas = diff->deltas.length;
 
 	/* TODO: maybe abort if deltas.length > rename_limit ??? */
-	if (!git__is_uint32(num_deltas))
+	if (!num_deltas || !git__is_uint32(num_deltas))
 		goto cleanup;
 
 	/* No flags set; nothing to do */