]> Cypherpunks repositories - gostls13.git/commitdiff
debug/dwarf: formStrp uses a 64-bit value for 64-bit DWARF
authorIan Lance Taylor <iant@golang.org>
Sat, 16 Dec 2017 02:02:57 +0000 (18:02 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 15 Feb 2018 18:54:41 +0000 (18:54 +0000)
No test as the only system I know that uses 64-bit DWARF is AIX.

Change-Id: I24e225253075be188845656b6778993c2d24ebf5
Reviewed-on: https://go-review.googlesource.com/84379
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/debug/dwarf/entry.go

index ffa61c28d15b4f55f0cc3bfab9e514a1e54d946d..6be0700b7ef11452e58f69e3eec81ad56407efa6 100644 (file)
@@ -461,7 +461,18 @@ func (b *buf) entry(atab abbrevTable, ubase Offset) *Entry {
                case formString:
                        val = b.string()
                case formStrp:
-                       off := b.uint32() // offset into .debug_str
+                       var off uint64 // offset into .debug_str
+                       is64, known := b.format.dwarf64()
+                       if !known {
+                               b.error("unknown size for DW_FORM_strp")
+                       } else if is64 {
+                               off = b.uint64()
+                       } else {
+                               off = uint64(b.uint32())
+                       }
+                       if uint64(int(off)) != off {
+                               b.error("DW_FORM_strp offset out of range")
+                       }
                        if b.err != nil {
                                return nil
                        }