Skip to content

Commit

Permalink
When the experimental two-level line table
Browse files Browse the repository at this point in the history
support was written one test for '> sectionend'
was wrong, it needs to be '>= sectionend'.
Written in 2021.
In some other cases '>' is ok.
Fixing DW202305-003 oss-fuzz 59091
	modified:   src/lib/libdwarf/dwarf_line_table_reader_common.h
  • Loading branch information
davea42 committed May 19, 2023
1 parent 2783706 commit 4017ab8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lib/libdwarf/dwarf_line_table_reader_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
line_context->lc_section_offset = starting_line_ptr -
dbg->de_debug_line.dss_data;
/* ASSERT: line_context->lc_length_field_length == line_ptr
-line_context->lc_line_ptr_start; */
-line_context->lc_line_ptr_start;
The following test allows the == case too
as that is normal for the last CUs line table. */
if (line_ptr_end > section_end) {
dwarfstring m;

Expand Down Expand Up @@ -531,6 +533,7 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
} else {
/* No old style directory entries. */
}
/* Later tests will deal with the == case as required. */
if (line_ptr > line_ptr_end) {
_dwarf_error(dbg, err, DW_DLE_LINE_OFFSET_BAD);
return DW_DLV_ERROR;
Expand Down Expand Up @@ -621,6 +624,7 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
} else {
/* No old style filenames entries. */
}
/* Later tests will deal with the == case as required. */
if (line_ptr > line_ptr_end) {
_dwarf_error(dbg, err, DW_DLE_LINE_OFFSET_BAD);
return DW_DLV_ERROR;
Expand Down Expand Up @@ -654,6 +658,7 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
line_ptr, local_length_size,err,line_ptr_end);
line_context->lc_actuals_table_offset = actuals_table_offset;
line_ptr += local_length_size;
/* Later tests will deal with the == case as required. */
if (line_ptr > line_ptr_end) {
_dwarf_error(dbg, err, DW_DLE_LINE_OFFSET_BAD);
return DW_DLV_ERROR;
Expand Down Expand Up @@ -786,6 +791,7 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
return DW_DLV_ERROR;
}
}
/* Later tests will deal with the == case as required. */
if (line_ptr > line_ptr_end) {
free(format_values);
format_values = 0;
Expand Down Expand Up @@ -1060,7 +1066,8 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
Dwarf_Unsigned j = 0;
int dres = 0;

if (line_ptr > line_ptr_end) {
/* line_ptr_end is *after* the valid area */
if (line_ptr >= line_ptr_end) {
_dwarf_error(dbg, err, DW_DLE_LINE_NUMBER_HEADER_ERROR);
return DW_DLV_ERROR;
}
Expand Down

0 comments on commit 4017ab8

Please sign in to comment.