exploitability_linux: fix mismatched comparison warning

On ARM, this write fails to build:
comparison of integers of different signs: 'ssize_t' (aka 'int') and
'const unsigned int' [-Werror,-Wsign-compare]

Since we check that it's <= 15 above, we can simply cast it without
issue.

Bug: b:235999011
Change-Id: Id75fc0df74e88b347df615df06567e96c6b59a1d
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3758800
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
George Burgess IV 2022-07-12 13:13:14 -07:00 committed by George Burgess
parent e9057e2d5e
commit eb087c3383

View file

@ -502,7 +502,9 @@ bool ExploitabilityLinux::DisassembleBytes(const string& architecture,
unlink(raw_bytes_tmpfile);
return false;
}
if (write(raw_bytes_fd, raw_bytes, raw_bytes_len) != raw_bytes_len) {
// Casting raw_bytes_len to `ssize_t` won't cause a sign flip, since we check
// its bounds above.
if (write(raw_bytes_fd, raw_bytes, raw_bytes_len) != (ssize_t)raw_bytes_len) {
BPLOG(ERROR) << "Writing of raw bytes failed.";
unlink(raw_bytes_tmpfile);
return false;