From: Peter O. <obe...@us...> - 2010-02-21 14:56:57
|
Update of /cvsroot/ltp/utils/analysis/lcov/bin In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv18962 Modified Files: geninfo Log Message: geninfo: fix problem with some .gcno files Some .gcno files contain more data in a line record than expected. Skip unhandled bytes of a .gcno file record. This prevents the following unexpected error message: geninfo: ERROR: file.gcno: reached unexpected end of file Index: geninfo =================================================================== RCS file: /cvsroot/ltp/utils/analysis/lcov/bin/geninfo,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** geninfo 29 Jan 2010 11:07:25 -0000 1.71 --- geninfo 21 Feb 2010 14:56:46 -0000 1.72 *************** *** 2858,2861 **** --- 2858,2864 ---- graph_skip(*HANDLE, 8, "version and stamp") or goto incomplete; while (!eof(HANDLE)) { + my $next_pos; + my $curr_pos; + # Read record tag $tag = read_gcno_value(*HANDLE, $big_endian, "record tag"); *************** *** 2867,2870 **** --- 2870,2878 ---- # Convert length to bytes $length *= 4; + # Calculate start of next record + $next_pos = tell(HANDLE); + goto tell_error if ($next_pos == -1); + $next_pos += $length; + # Process record if ($tag == $tag_function) { ($filename, $function) = read_gcno_function_record( *************** *** 2883,2886 **** --- 2891,2902 ---- or goto incomplete; } + # Ensure that we are at the start of the next record + $curr_pos = tell(HANDLE); + goto tell_error if ($curr_pos == -1); + next if ($curr_pos == $next_pos); + goto record_error if ($curr_pos > $next_pos); + graph_skip(*HANDLE, $next_pos - $curr_pos, + "unhandled record content") + or goto incomplete; } close(HANDLE); *************** *** 2899,2902 **** --- 2915,2924 ---- graph_error($gcno_filename, "found unrecognized gcno file magic"); return undef; + tell_error: + graph_error($gcno_filename, "could not determine file position"); + return undef; + record_error: + graph_error($gcno_filename, "found unrecognized record format"); + return undef; } |