aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index b57e1e0..72f9dda 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -10178,8 +10178,9 @@ process_version_sections (FILE * file)
printf (_(" Index: %d Cnt: %d "),
ent.vd_ndx, ent.vd_cnt);
- /* Check for overflow. */
- if (ent.vd_aux + sizeof (* eaux) > (size_t) (endbuf - vstart))
+ /* Check for overflow and underflow. */
+ if (ent.vd_aux + sizeof (* eaux) > (size_t) (endbuf - vstart)
+ || (vstart + ent.vd_aux < vstart))
break;
vstart += ent.vd_aux;