diff options
| author | Mark Wielaard <[email protected]> | 2015-05-05 10:05:01 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-05-12 16:34:39 +0200 |
| commit | 3c1d1642789856f7a7975b92429747254083149f (patch) | |
| tree | b667d96ee8f1137bf77b89dd005c179325891401 /libdwfl | |
| parent | d26aea9da7d618de41c797da405637dd67733956 (diff) | |
libdwfl: Bounds check Dwarf_Fileinfo file number in dwfl_lineinfo.
https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c30
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdwfl')
| -rw-r--r-- | libdwfl/ChangeLog | 4 | ||||
| -rw-r--r-- | libdwfl/dwfl_lineinfo.c | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index d9922b4a..de76378d 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2015-05-05 Mark Wielaard <[email protected]> + + * dwfl_lineinfo.c (dwfl_lineinfo): Check info->file is valid. + 2015-05-06 Roland McGrath <[email protected]> * dwfl_error.c (struct msgtable): Break type definition out of diff --git a/libdwfl/dwfl_lineinfo.c b/libdwfl/dwfl_lineinfo.c index dfb27d82..7ddbfb07 100644 --- a/libdwfl/dwfl_lineinfo.c +++ b/libdwfl/dwfl_lineinfo.c @@ -1,5 +1,5 @@ /* Get information from a source line record returned by libdwfl. - Copyright (C) 2005-2010 Red Hat, Inc. + Copyright (C) 2005-2010, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -46,6 +46,12 @@ dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, int *linep, int *colp, if (colp != NULL) *colp = info->column; + if (unlikely (info->file >= info->files->nfiles)) + { + __libdwfl_seterrno (DWFL_E (LIBDW, DWARF_E_INVALID_DWARF)); + return NULL; + } + struct Dwarf_Fileinfo_s *file = &info->files->info[info->file]; if (mtime != NULL) *mtime = file->mtime; |
