Skip to content

Commit 490d0c9

Browse files
committed
diff_print: return out-of-memory situation when printing binary
We currently don't check for out-of-memory situations on exiting `format_binary` and, as a result, may return a partially filled buffer. Fix this by checking the buffer via `git_buf_oom`.
1 parent bea5fd9 commit 490d0c9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/diff_print.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@ static int format_binary(
491491
}
492492
git_buf_putc(pi->buf, '\n');
493493

494+
if (git_buf_oom(pi->buf))
495+
return -1;
496+
494497
return 0;
495498
}
496499

0 commit comments

Comments
 (0)