[gdb/symtab] Fix overly large gdb-index file check for 32-bit
authorTom de Vries <tdevries@suse.de>
Sat, 16 Sep 2023 02:10:53 +0000 (04:10 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 16 Sep 2023 02:10:53 +0000 (04:10 +0200)
commit93203eebe2abf35d94d738541e4c62472a4102b8
treecf663f54612d0c449bb4f7d60ea6902b5418ef41
parentcbabd45022bf05137475dd8a3c2b4ff67486fc4f
[gdb/symtab] Fix overly large gdb-index file check for 32-bit

Add a unit test which checks that write_gdb_index_1 will throw
an error when the size of the file would exceed the maximum value
capable of being represented by 'offset_type'.

The unit test fails on 32-bit systems due to wrapping overflow.  Fix this by
changing the type of total_len in write_gdbindex_1 from size_t to uint64_t.

Tested on x86_64-linux.

Co-Authored-By: Kevin Buettner <kevinb@redhat.com>
Approved-by: Kevin Buettner <kevinb@redhat.com>
gdb/dwarf2/index-write.c