git-last-modified BUG()s when dealing with criss-cross merges

git-last-modified(1) was merged into next, but Patrick discovered a bug when running git last-modified next in git.git:

$ git last-modified
3f3e11118993fe0500b3957ab798e39caaa3952f	.gitignore
3f3e11118993fe0500b3957ab798e39caaa3952f	Makefile
3f3e11118993fe0500b3957ab798e39caaa3952f	builtin.h
3f3e11118993fe0500b3957ab798e39caaa3952f	command-list.txt
3f3e11118993fe0500b3957ab798e39caaa3952f	commit-graph.c
3f3e11118993fe0500b3957ab798e39caaa3952f	git.c
3f3e11118993fe0500b3957ab798e39caaa3952f	meson.build
56072ff0384da5d874fc378d36e089a18f28f1e3	fetch-pack.c
457534d0417d047b943f76a849f256b739894ce9	progress.c
0d8f4ccfe3b13bb5eb95f030dc5fe76efb255397	for-each-ref.h
109c3df14ccf372c2438a470bdfb566265399f0a	combine-diff.c
109c3df14ccf372c2438a470bdfb566265399f0a	diff.c
109c3df14ccf372c2438a470bdfb566265399f0a	diff.h
109c3df14ccf372c2438a470bdfb566265399f0a	dir.c
[snip]
9e5878fbede57c0499133adf73844261849cd7b2	git-web--browse.sh
b2fb3911eab730a08168c7f85a7935ad5a330b53	config.mak.in
36268b762c4aa6a0d4831f69852b20ab545aff4d	LGPL-2.1
1e58dba142c673c59fbb9d10aeecf62217d4fc9c	aclocal.m4
9517e6b84357252e1882091343661c34d978771e	levenshtein.h
703601d6780c32d33dadf19b2b367f2f79e1e34c	COPYING
BUG: ../builtin/last-modified.c:236: paths remaining beyond boundary in last-modified
zsh: IOT instruction (core dumped)  git last-modified

This seems to be related to criss-cross merges.