File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -348,8 +348,9 @@ static int apply_binary(
348348 & patch -> binary .old_file )) < 0 )
349349 goto done ;
350350
351+ /* Verify that the resulting file with the reverse patch applied matches the source file */
351352 if (source_len != reverse .size ||
352- memcmp (source , reverse .ptr , source_len ) != 0 ) {
353+ ( source_len && memcmp (source , reverse .ptr , source_len ) != 0 ) ) {
353354 error = apply_err ("binary patch did not apply cleanly" );
354355 goto done ;
355356 }
Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ static int apply_patchfile(
4343
4444 if (error == 0 ) {
4545 cl_assert_equal_i (new_len , result .size );
46- cl_assert (memcmp (new , result .ptr , new_len ) == 0 );
46+ if (new_len )
47+ cl_assert (memcmp (new , result .ptr , new_len ) == 0 );
4748
4849 cl_assert_equal_s (filename_expected , filename );
4950 cl_assert_equal_i (mode_expected , mode );
You canβt perform that action at this time.
0 commit comments