[PATCH] builtin-fast-export.c: add default case to avoid crash on corrupt repo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This small issue was discovered by Benjamin Kramers Clang-runs on the git
code-base. If a tag object points to an object that is not a commit or a blob,
an invalid pointer is dereferenced in the code that followed.

This patch fixes this issue, by giving an error instead. This should also be
more useful when debugging corrupted repos.

Signed-off-by: Erik Faye-Lund <kusmabite@xxxxxxxxx>
---
 builtin-fast-export.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index fdf4ae9..26b2a93 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -375,6 +375,9 @@ static void get_tags_and_duplicates(struct object_array *pending,
 			case OBJ_BLOB:
 				handle_object(tag->object.sha1);
 				continue;
+			default:
+				die ("Unexpected object of type %s",
+				     typename(tag->object.type));
 			}
 			break;
 		default:
-- 
1.6.2.1.215.gf786.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux