[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/6] gdbstub: Reject invalid RLE repeat counts
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH 3/6] gdbstub: Reject invalid RLE repeat counts |
Date: |
Thu, 18 Apr 2019 17:26:54 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 4/18/19 4:53 PM, Markus Armbruster wrote:
> "Debugging with GDB / Appendix E GDB Remote Serial Protocol /
> Overview" specifies "The printable characters '#' and '$' or with a
> numeric value greater than 126 must not be used." gdb_read_byte()
> only rejects values < 32. This is wrong. Impact depends on the caller:
>
> * gdb_handlesig() passes a char. Incorrectly accepts '#', '$' and
> '\127'.
>
> * gdb_chr_receive() passes an uint8_t. Additionally accepts
> characters with the most-significant bit set.
>
> Correct the validity check to match the specification.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> gdbstub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdbstub.c b/gdbstub.c
> index d54abd17cc..a6dce1b027 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -2064,7 +2064,7 @@ static void gdb_read_byte(GDBState *s, int ch)
> }
> break;
> case RS_GETLINE_RLE:
> - if (ch < ' ') {
Can you add a comment referring to the ""Debugging with GDB / Appendix E
GDB Remote Serial Protocol / Overview" here?
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> + if (ch < ' ' || ch == '#' || ch == '$' || ch > 126) {
> /* invalid RLE count encoding */
> trace_gdbstub_err_invalid_repeat((uint8_t)ch);
> s->state = RS_GETLINE;
>
- [Qemu-devel] [PATCH 0/6] Fix misuse of ctype.h functions, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PATCH 5/6] pc-bios/s390-ccw: Clean up harmless misuse of isdigit(), Markus Armbruster, 2019/04/18
- [Qemu-devel] [PATCH 3/6] gdbstub: Reject invalid RLE repeat counts, Markus Armbruster, 2019/04/18
- Re: [Qemu-devel] [PATCH 3/6] gdbstub: Reject invalid RLE repeat counts,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 4/6] gdbstub: Fix misuse of isxdigit(), Markus Armbruster, 2019/04/18
- [Qemu-devel] [PATCH 6/6] cutils: Simplify how parse_uint() checks for whitespace, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PATCH 2/6] tests/vhost-user-bridge: Fix misuse of isdigit(), Markus Armbruster, 2019/04/18
- [Qemu-devel] [PATCH 1/6] qemu-bridge-helper: Fix misuse of isspace(), Markus Armbruster, 2019/04/18