diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2026-08-12 08:03:15 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-08-12 09:05:50 -0700 |
| commit | 02b9662a6ed42946c32ca3e5b2aead336348748f (patch) | |
| tree | d4abc6bb98d640d3e3b9739ed0e634a4c937a3a1 /gitweb/gitweb.cgi | |
| parent | ec428c66462bcd33766729180999a5c50d8ffc67 (diff) | |
compat/pread: check initial lseek for errors
git_pread() saves the current file offset via lseek(fd, 0,
SEEK_CUR) and later restores it. If the initial lseek fails
(e.g., the fd is a pipe or otherwise non-seekable),
current_offset is -1. This negative value is later passed to
lseek(fd, -1, SEEK_SET) at line 16, which sets the file position
to an unintended location (or fails with EINVAL on some
platforms).
Check the initial lseek return value and return -1 immediately
if it fails, consistent with the error handling for the other
lseek calls in the same function.
Pointed out by Coverity.
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/gitweb.cgi')
0 files changed, 0 insertions, 0 deletions
