Repository navigation
fix(cpp): resolve CodeQL findings and keep scans on first-party sources - #1162
Merged
Merged
Conversation
The C/C++ autobuild unpacks third-party dependencies under cpp/_codeql_build_dir and compiles them as part of the analysis. The quality scan reported about 560 alerts against those sources. The paths-ignore entry named the directory without a glob, which does not match a subtree, so the filter never took effect and the first scheduled run already produced the alerts it was meant to prevent. Match the directory with a ** glob, ignore the gitignored cpp/third_party build extracts as well, and share the configuration with the security scan, which had no config file and therefore analyzed the build directory too.
- Give ITimeseriesIndex a virtual destructor; it is held through shared_ptr<ITimeseriesIndex> and destroyed through the base type. - Qualify the reset() call in the TS2DIFFDecoder constructor so it does not dispatch to a derived override while the base is still being constructed. - Release SeriesScanStream's column iterator from its destructor instead of relying on the owner to call destroy(). - Use localtime_r/localtime_s in DaysSinceEpochToYYYYMMDD. localtime returns a shared buffer and its result was dereferenced unchecked. - Drop the int32 range check in date_to_int: year is bounded to 1000..9999, so the packed value cannot overflow. - Allocate the aligned ValueChunkWriter with std::nothrow so the following null check can actually fail instead of being dead code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
CodeQL configuration
The C/C++ autobuild unpacks third-party dependencies into
cpp/_codeql_build_dirand compiles them during the analysis, and the scheduled quality scan reported about 560 alerts against those sources. Thepaths-ignoreentry named the directory without a glob (cpp/_codeql_build_dir), which does not match a subtree — the configuration was already in place when the very first scan produced the alerts it was meant to prevent.**/_codeql_build_dir/**.cpp/third_partybuild extracts as well..github/codeql/codeql-config.ymland apply it to the security scan too, which had noconfig-fileand therefore analyzed the build directory as well.C++ findings
All from the CodeQL quality suite.
cpp/src/common/tsfile_common.hITimeseriesIndexgets a virtual destructor — it is held and destroyed through the base type viashared_ptrcpp/src/encoding/ts2diff_decoder.hTS2DIFFDecoder::reset()instead of dispatching to a derived override while the base is still being constructedcpp/src/reader/qds_with_timegenerator.hSeriesScanStreamreleases its column iterator from its own destructor instead of relying on the owner to calldestroy()cpp/src/utils/date_utils.hlocaltime_r/localtime_swith a checked result replaceslocaltime, which returns a shared buffer and was dereferenced uncheckedcpp/src/common/datatype/date_converter.hyearis bounded to 1000..9999, so the packed value cannot overflowcpp/src/writer/tsfile_writer.ccValueChunkWriterwithstd::nothrowso the following null check can actually failVerification
./mvnw -P with-cpp verify— BUILD SUCCESSNo codec, on-disk format, SDK, or CLI behavior changes, so the skill documentation is unaffected.
Alerts that already exist in
cpp/_codeql_build_dirstay open, because CodeQL cannot observe files that are excluded from analysis; they will be dismissed separately.🤖 Generated with Claude Code