commit - 1ea185225fc4897fdfbe0043837b43ddab3f1449
commit + 1b3c539b2dd85be56e0b40125774b3d621db6351
blob - 8fdb333fafc6ce71b39dd9e58a8c572346c797c2
blob + a1107f6772c2799cd66b0cda9c5c57362f9aa94f
--- lib/diff_output.c
+++ lib/diff_output.c
return EINVAL;
/* Locate the last atom. */
- foreach_diff_atom(atom, start_atom, atom_count - 1) {
- /* do nothing */;
- }
+ if (atom_count == 0)
+ return EINVAL;
+ atom = &start_atom[atom_count - 1];
rc = get_atom_byte(&ch, atom, atom->len - 1);
if (rc != DIFF_RC_OK)