libbpf: Fix theoretical u32 underflow in find_cd() function
authorDaniel Müller <deso@posteo.net>
Tue, 7 Mar 2023 21:55:04 +0000 (21:55 +0000)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 7 Mar 2023 23:30:47 +0000 (15:30 -0800)
commit3ecde2182adbb12b52b777d8fb4a599b43faf4f1
tree365403d9b978bcf7f1265d20d316a1b49b11c99e
parenta73dc912aa7e43f4f12003a26aeab839b500b86d
libbpf: Fix theoretical u32 underflow in find_cd() function

Coverity reported a potential underflow of the offset variable used in
the find_cd() function. Switch to using a signed 64 bit integer for the
representation of offset to make sure we can never underflow.

Fixes: 1eebcb60633f ("libbpf: Implement basic zip archive parsing support")
Signed-off-by: Daniel Müller <deso@posteo.net>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230307215504.837321-1-deso@posteo.net
tools/lib/bpf/zip.c