public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Some alloca removal and a printf bug fix
@ 2023-06-01  9:27 Andrew Burgess
  2023-06-01  9:27 ` [PATCH 1/4] gdb: fix printf of wchar_t early in a gdb session Andrew Burgess
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Andrew Burgess @ 2023-06-01  9:27 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi, Andrew Burgess

I previously posted this series in an attempt to remove lots of alloca use:

  https://inbox.sourceware.org/gdb-patches/cover.1677533215.git.aburgess@redhat.com/

there was some push back against that complete series, however, I
think the problem that was pointed out doesn't apply to one of the
original patches, so this series started with me trying to upstream
that one patch (this is patch #2 in this series).

However, while reviewing the patch again I spotted a bug I'd
introduced.  Which means we have a gap in our testing, as the bug was
not exposed during testing.  So I started to write a test, and hit
another bug (not one introduced by me), this is fixed in patch #1 in
this series.

My original series didn't remove all the uses of alloca from
printcmd.c, I don't recall why.  But on review it's actually pretty
easy to remove the final alloca from printcmd.c, so that's what
patch #3 in this series does.

And finally, while working on patch #2 I realised that a badly formed
inferior (e.g. one that needed debugging due to memory corruption)
could cause GDB to try and allocate a huge ammount of memory,
potentially crashing GDB.  This is mitigated in patch #4.

---

Andrew Burgess (4):
  gdb: fix printf of wchar_t early in a gdb session
  gdb: remove two uses of alloca from printcmd.c
  gdb: remove last alloca call from printcmd.c
  gdb: check max-value-size when reading strings for printf

 gdb/c-lang.c                              |   3 -
 gdb/gdbtypes.c                            |  11 ++-
 gdb/gdbtypes.h                            |  14 ++-
 gdb/printcmd.c                            | 102 +++++++++++++---------
 gdb/testsuite/gdb.base/printcmds.c        |   2 +
 gdb/testsuite/gdb.base/printcmds.exp      |   5 ++
 gdb/testsuite/gdb.base/printf-wchar_t.c   |  28 ++++++
 gdb/testsuite/gdb.base/printf-wchar_t.exp |  32 +++++++
 gdb/testsuite/lib/gdb.exp                 |  30 +++++++
 gdb/value.c                               |  10 ++-
 gdb/value.h                               |   5 ++
 11 files changed, 192 insertions(+), 50 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/printf-wchar_t.c
 create mode 100644 gdb/testsuite/gdb.base/printf-wchar_t.exp


base-commit: e9683acf5e51c2bac8aa68d30d9ac3683dddcc7d
-- 
2.25.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-07 14:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01  9:27 [PATCH 0/4] Some alloca removal and a printf bug fix Andrew Burgess
2023-06-01  9:27 ` [PATCH 1/4] gdb: fix printf of wchar_t early in a gdb session Andrew Burgess
2023-06-02 16:54   ` Tom Tromey
2023-06-01  9:27 ` [PATCH 2/4] gdb: remove two uses of alloca from printcmd.c Andrew Burgess
2023-06-01  9:27 ` [PATCH 3/4] gdb: remove last alloca call " Andrew Burgess
2023-06-01  9:27 ` [PATCH 4/4] gdb: check max-value-size when reading strings for printf Andrew Burgess
2023-06-02 17:05   ` Tom Tromey
2023-06-05  9:43   ` Andrew Burgess
2023-07-04 13:20     ` Andrew Burgess
2023-07-04 13:24       ` Eli Zaretskii
2023-06-02 17:06 ` [PATCH 0/4] Some alloca removal and a printf bug fix Tom Tromey
2023-07-07 14:34   ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).