File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -459,10 +459,11 @@ int git_commit__parse(void *_commit, git_odb_object *odb_obj)
459459 buffer = buffer_start + header_len + 1 ;
460460
461461 /* extract commit message */
462- if (buffer <= buffer_end ) {
462+ if (buffer <= buffer_end )
463463 commit -> raw_message = git__strndup (buffer , buffer_end - buffer );
464- GITERR_CHECK_ALLOC (commit -> raw_message );
465- }
464+ else
465+ commit -> raw_message = git__strdup ("" );
466+ GITERR_CHECK_ALLOC (commit -> raw_message );
466467
467468 return 0 ;
468469
Original file line number Diff line number Diff line change @@ -447,7 +447,12 @@ int git_tree__parse(void *_tree, git_odb_object *odb_obj)
447447 if ((nul = memchr (buffer , 0 , buffer_end - buffer )) == NULL )
448448 return tree_error ("Failed to parse tree. Object is corrupted" , NULL );
449449
450- filename_len = nul - buffer ;
450+ if ((filename_len = nul - buffer ) == 0 )
451+ return tree_error ("Failed to parse tree. Can't parse filename" , NULL );
452+
453+ if ((buffer_end - (nul + 1 )) < GIT_OID_RAWSZ )
454+ return tree_error ("Failed to parse tree. Can't parse OID" , NULL );
455+
451456 /* Allocate the entry */
452457 {
453458 entry = git_array_alloc (tree -> entries );
You can’t perform that action at this time.
0 commit comments