schwehr / generic-sensor-format

Sonar Generic Sensor Format (gsf) codec
Other
13 stars 8 forks source link

More unchecked return values from fseek in gsf_indx.c #61

Closed schwehr closed 8 years ago

schwehr commented 8 years ago

Coverity found these, but others were masked by issues.

Additionally:

grep -n -A 1 -B 1 '  fseek' gsf_indx.c
410-
411:        fseek(ft->index_data.fp, ft->index_data.start_addr[0], 0);
412-        for (i = 0; i < ft->index_data.number_of_records[0]; i++)
--
927-             */
928:            fseek(temp[i], 0, 0);
929-            ft->index_data.start_addr[i] = ftell(ft->index_data.fp);
--
967-             */
968:            fseek(ft->index_data.fp, (j * 16) + 48, 0);
969-            fwrite(&ft->index_data.record_type[i], 4, 1,
--
976-            /* Advance to the end of the index file. */
977:            fseek(ft->index_data.fp, 0, SEEK_END);
978-
--
999-
1000:        fseek(ft->index_data.fp, ft->index_data.start_addr[0], 0);
1001-        for (i = 0; i < ft->index_data.number_of_records[0]; i++)
--
1257-    }
1258:    fseek(ft->fp, save_pos, SEEK_SET);
1259-
--
1750-             */
1751:            fseek(temp[i], 0, 0);
1752-            ft->index_data.start_addr[i] = ftell(ft->index_data.fp);
--
1774-             */
1775:            fseek(ft->index_data.fp, (j * 16) + 48, 0);
1776-
--
1798-            /* Advance to the end of the index file. */
1799:            fseek(ft->index_data.fp, 0, SEEK_END);
1800-
schwehr commented 8 years ago

Confirmed by Coverity Scan

schwehr commented 8 years ago

Fixing CID 113078 also fixed CID 113076.