]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb, gdbserver: fix read/write_ptid types
authorMarkus Metzger <markus.t.metzger@intel.com>
Wed, 24 Sep 2025 12:08:55 +0000 (12:08 +0000)
committerMarkus Metzger <markus.t.metzger@intel.com>
Mon, 17 Nov 2025 07:12:38 +0000 (07:12 +0000)
commit7db0fccae52949d98eba248ba7ecd9318edfe20a
treec9925ca41ffd474e7042083aa3e4dfdca3ea45af
parentef706f09f1e53715810903a1aad5cdd4dc57d249
gdb, gdbserver: fix read/write_ptid types

In write_ptid(), a ptid's LWP member, which is declared long, is stored in
an int local variable before printing, potentially truncating it.  Fix it.

In read_ptid(), both PID and LWP are read as ULONGEST and then cast to
their respective type without checking for overflows.  Fix it.

In read_ptid(), an empty component is treated as zero.  Diagnose that as
an error, instead.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/remote.c
gdbserver/remote-utils.cc