linxt20 opened a new issue, #468:
URL: https://github.com/apache/tsfile/issues/468

   bug1-nullPointer-tsfile_reader_table_test.cc-159
   bug2-nullPointer-tsfile_reader_table_test.cc-247:
   bug3-nullPointer-tsfile_reader_table_test.cc-358:
   bug4-nullPointer-tsfile_reader_test.cc-144:
   bug5-nullPointer-tsfile_writer_test.cc-192:
   bug6-nullPointer-tsfile_writer_test.cc-371:
   bug7-nullPointer-tsfile_writer_test.cc-623:
   bug8-nullPointer-tsfile_writer_test.cc-757:
   bug9-nullPointer-tsfile_writer_test.cc-827:
   bug10-nullPointer-tsfile_writer_test.cc-897.
   
   These 10 bugs belong to the same problem, that is, the query result may be 
nullptr, and the API needs to be checked before calling.
   
   Take bug1 as an example:
   Problem description: The table_result_set here may be a null pointer, and 
the next operation cannot be called.
   Cause analysis: The table_result_set here comes from the reference parameter 
tmp_result_set passed in by reader.query. In the query of the reader, the query 
function of table_query_executor will be called to complete the actual result 
return, but in the query function of TableQueryExecutor, the return result 
ret_qds can be nullptr (nullptr is assigned in line 41). Therefore, when 
performing next on the query result, you need to check whether it is nullptr 
first.
   
   bug11-nullPointerArithmetic-gzip_compressor_test.cc-90:
   bug12-nullPointerArithmetic-gzip_compressor_test.cc-124:
   bug13-nullPointerArithmetic-lz4_compressor_test.cc-90:
   bug14-nullPointerArithmetic-lz4_compressor_test.cc-123:
   bug15-nullPointerArithmetic-lzo_compressor_test.cc-90:
   bug16-nullPointerArithmetic-lzo_compressor_test.cc-123:
   bug17-nullPointerArithmetic-snappy_compressor_test.cc-90:
   bug18-nullPointerArithmetic-snappy_compressor_test.cc-123: .
   
   These 8 bugs belong to the same problem, that is, the result of 
decompression may be nullptr, which needs to be checked before it can be used 
as a pointer for calculation.
   
   Take bug11 as an example:
   Problem description: The decpmressed_buf here may be a null pointer and 
cannot be directly involved in pointer calculation.
   Cause analysis: The decpmressed_buf here comes from the reference parameter 
decpmressed_buf of the uncompress operation of the compressor, and the 
uncompress function will call the corresponding decompression function. In the 
decompression function of gzip, the passed parameter will not be assigned when 
the decompression fails, and will be assigned to nullptr when the byte stream 
is empty. Therefore, there is a possibility of a null pointer, and it needs to 
be checked before use. At the same time, when observing the code, it is found 
that the status code of whether the decompression is successful is not returned 
and checked, which is also a risk point.
   
   bug19-containerOutOfBounds-expression.cc-115.
   Problem description: When the size is 0, an exception should be thrown, but 
it is not thrown here, causing the program to continue running. In an abnormal 
situation, at(0) was called, and an out-of-bounds situation occurred. From the 
code, if the execution continues in the abnormal situation, there will be more 
errors, so it is necessary to interrupt in the abnormal situation.
   
   bug20-missingMemberCopy-schema.h-236.
   Problem description: In the move constructor, the variable column_pos_index_ 
is omitted when assigning a value, which will cause an abnormal result.
   
   Other serious abnormality investigations:
   - memleak 3: confirmed as a false positive after investigation.
   - virtualCallInConstructor 1: confirmed as a false positive after 
investigation.
   - uninitMemberVar 3: confirmed as a false positive after investigation.
   
   Among other problems, the test unit is marked as an unused function, so it 
accounts for a large number. Most of the others are code style and optimization 
suggestion issues, such as static variable and constant variable optimization, 
redundant assignment, check and variable issues.
   
   the cppcheck result file link: 
https://pan.baidu.com/s/1EisYqq5Iey9Q0M9rT5c_Gw?pwd=vsev


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to