[PATCH] Protect against integer overflow on shnum

2017-04-20 Thread Ulf Hermann
If shnum is 0, the many "shnum - 1" would result in an overflow. Check it for 0, and only subtract once, rather than on every usage. Signed-off-by: Ulf Hermann --- libdwfl/ChangeLog | 5 + libdwfl/dwfl_module_getdwarf.c | 18 ++ src/ChangeLog |

Re: [PATCH] Protect against integer overflow on shnum

2017-04-27 Thread Mark Wielaard
On Thu, Apr 20, 2017 at 04:04:54PM +0200, Ulf Hermann wrote: > If shnum is 0, the many "shnum - 1" would result in an overflow. Check it > for 0, and only subtract once, rather than on every usage. Since in both cases this is for the prelink undo section which skips the zero header this is a more