[PATCH] D79013: [llvm-readelf] - Do not crash when the PT_INTERP has an invalid offset.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 02:32:42 PDT 2020


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/gnu-phdrs.test:322
+# ERROR-INTERP:      Type           Offset
+# ERROR-INTERP-NEXT: INTERP         0x000[[#%x,OFFSET:0x000230]]
+# ERROR-INTERP-NEXT:     [Requesting program interpreter: C]
----------------
jhenderson wrote:
> I believe you don't want the leading 0x000 bit, and then you also won't need the %x either. I believe FileCheck will automatically recognise it as hex that way (as things stand, I think it might not, but can't remember the details). If you want ot be sure that it is hex though, you can keep the %x (and might need it in the lines below too to be sure its always hex, but I'm not sure - experimentation needed). FWIW, I don't think it being hex is a necessary check for this specific case, since we check it earlier.
> I believe you don't want the leading 0x000 bit, and then you also won't need the %x either.

It does not work for me, this was the only way I've managed to make this work.

The following fail:


```
# ERROR-INTERP:      Type           Offset
# ERROR-INTERP-NEXT: INTERP         [[#OFFSET:]]
# ERROR-INTERP-NEXT:     [Requesting program interpreter: C]
# ERROR-INTERP-NEXT: INTERP         [[#OFFSET + 1]]
# ERROR-INTERP-NEXT:     [Requesting program interpreter: ]
```

```
D:\Work3\LLVM\llvm-project\llvm\test\tools\llvm-readobj\ELF\gnu-phdrs.test:324:2
2: error: ERROR-INTERP-NEXT: expected string not found in input
# ERROR-INTERP-NEXT: INTERP [[#OFFSET + 1]]
                     ^
<stdin>:10:2: note: scanning from here
 INTERP 0x000231 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0x1
 ^
<stdin>:10:2: note: with "OFFSET + 1" equal to "1"
 INTERP 0x000231 0x0000000000000000 0x0000000000000000 0x000000 0x000000 0x1
 ^
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79013/new/

https://reviews.llvm.org/D79013





More information about the llvm-commits mailing list