diff options
author | Eli Zaretskii <eliz@gnu.org> | 2004-02-27 17:46:11 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2004-02-27 17:46:11 +0000 |
commit | e6a8a7d2ae3a1c722ad2f8fa1ad20232af2dbfd3 (patch) | |
tree | c1a9b6971675db8335e495d07ecdc308f30a9004 /gdb/coffread.c | |
parent | b60d7a1a49802b79d6aae68c834e02e801f5aaf9 (diff) | |
download | ppe42-binutils-e6a8a7d2ae3a1c722ad2f8fa1ad20232af2dbfd3.tar.gz ppe42-binutils-e6a8a7d2ae3a1c722ad2f8fa1ad20232af2dbfd3.zip |
2004-02-27 Eli Zaretskii <eliz@elta.co.il>
* coffread.c (enter_linenos): Don't let rawptr reference memory
outside linetab[]'s limits.
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r-- | gdb/coffread.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c index b0468e0234..056ba13747 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1362,11 +1362,15 @@ enter_linenos (long file_offset, int first_line, /* line numbers start at one for the first line of the function */ first_line--; - for (;;) + /* If the line number table is full (e.g. 64K lines in COFF debug + info), the next function's L_LNNO32 might not be zero, so don't + overstep the table's end in any case. */ + while (rawptr <= &linetab[0] + linetab_size) { bfd_coff_swap_lineno_in (symfile_bfd, rawptr, &lptr); rawptr += local_linesz; - /* The next function, or the sentinel, will have L_LNNO32 zero; we exit. */ + /* The next function, or the sentinel, will have L_LNNO32 zero; + we exit. */ if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line) record_line (current_subfile, first_line + L_LNNO32 (&lptr), lptr.l_addr.l_paddr |