@@ -234,7 +234,9 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
234234 line_context -> lc_section_offset = starting_line_ptr -
235235 dbg -> de_debug_line .dss_data ;
236236 /* ASSERT: line_context->lc_length_field_length == line_ptr
237- -line_context->lc_line_ptr_start; */
237+ -line_context->lc_line_ptr_start;
238+ The following test allows the == case too
239+ as that is normal for the last CUs line table. */
238240 if (line_ptr_end > section_end ) {
239241 dwarfstring m ;
240242
@@ -531,6 +533,7 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
531533 } else {
532534 /* No old style directory entries. */
533535 }
536+ /* Later tests will deal with the == case as required. */
534537 if (line_ptr > line_ptr_end ) {
535538 _dwarf_error (dbg , err , DW_DLE_LINE_OFFSET_BAD );
536539 return DW_DLV_ERROR ;
@@ -621,6 +624,7 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
621624 } else {
622625 /* No old style filenames entries. */
623626 }
627+ /* Later tests will deal with the == case as required. */
624628 if (line_ptr > line_ptr_end ) {
625629 _dwarf_error (dbg , err , DW_DLE_LINE_OFFSET_BAD );
626630 return DW_DLV_ERROR ;
@@ -654,6 +658,7 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
654658 line_ptr , local_length_size ,err ,line_ptr_end );
655659 line_context -> lc_actuals_table_offset = actuals_table_offset ;
656660 line_ptr += local_length_size ;
661+ /* Later tests will deal with the == case as required. */
657662 if (line_ptr > line_ptr_end ) {
658663 _dwarf_error (dbg , err , DW_DLE_LINE_OFFSET_BAD );
659664 return DW_DLV_ERROR ;
@@ -786,6 +791,7 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
786791 return DW_DLV_ERROR ;
787792 }
788793 }
794+ /* Later tests will deal with the == case as required. */
789795 if (line_ptr > line_ptr_end ) {
790796 free (format_values );
791797 format_values = 0 ;
@@ -1060,7 +1066,8 @@ _dwarf_read_line_table_header(Dwarf_Debug dbg,
10601066 Dwarf_Unsigned j = 0 ;
10611067 int dres = 0 ;
10621068
1063- if (line_ptr > line_ptr_end ) {
1069+ /* line_ptr_end is *after* the valid area */
1070+ if (line_ptr >= line_ptr_end ) {
10641071 _dwarf_error (dbg , err , DW_DLE_LINE_NUMBER_HEADER_ERROR );
10651072 return DW_DLV_ERROR ;
10661073 }
0 commit comments