]> git.eshelyaron.com Git - emacs.git/commit
Fix insert-file-contents overlap check
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 16 Jul 2025 05:36:54 +0000 (22:36 -0700)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 09:48:04 +0000 (11:48 +0200)
commitb483bff07e3e1aa0fc44e45440619b66fafed089
tree957138184a27d3b6f117798292706f1c23ae2966
parent10d018360dbe75cb7dc9186dd312d7ad63941c3f
Fix insert-file-contents overlap check

In commit 61a8ce0280668980a4452b112103c9bc879e1f49 I mistakenly
focused on overlap in the buffer.  The code also needs to check
for overlap in the inserted file data.
Problem reported by Gerd Möllmann (Bug#79020).
* src/fileio.c (Finsert_file_contents): Prevent overlap in both
the buffer head and tail, and in the inserted file’s head and tail.
Also, shrink the file’s head if the file shrank to be smaller
than its head.

(cherry picked from commit 42548c25f74d4509a1d29cb419e1b2f7b4a12c10)
src/fileio.c