Skip to content

Commit 8ecb1f5

Browse files
committed
Add intentional errors in files which are already in the project
1 parent 3859fe3 commit 8ecb1f5

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

.github/workflows/static_analysis.yml

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
workflow_dispatch:
55
schedule:
66
- cron: "0 3 * * *"
7+
pull_request:
78

89
jobs:
910
polaris-scan:
@@ -71,3 +72,11 @@
7172
polaris_reports_sarif_groupSCAIssues: true
7273
polaris_upload_sarif_report: true
7374
polaris_prComment_severities: "high,critical,medium,low"
75+
76+
- name: Upload .bridge artifact
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: Bridge Logs
80+
path: ${{github.workspace}}/.bridge
81+
if-no-files-found: error
82+
include-hidden-files: true

cpp/arcticdb/codec/encode_v1.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ namespace arcticdb {
107107
[[nodiscard]] Segment encode_v1(SegmentInMemory&& s, const arcticdb::proto::encoding::VariantCodec &codec_opts) {
108108
ARCTICDB_SAMPLE(EncodeSegment, 0)
109109
auto in_mem_seg = std::move(s);
110+
111+
// INTENTIONAL
112+
std::vector<int> arr(3);
113+
s.end_row();
114+
std::cout<<s.num_blocks()<< " " <<s.num_blocks()<<'\n';
115+
auto a = s.clone();
116+
s.clear();
117+
std::cout<<arr.data()[4];
118+
119+
110120
SegmentHeader segment_header{EncodingVersion::V1};
111121
segment_header.set_compacted(in_mem_seg.compacted());
112122

cpp/arcticdb/version/local_versioned_engine.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,17 @@ VersionedItem LocalVersionedEngine::compact_incomplete_dynamic(
10451045
const CompactIncompleteOptions& options) {
10461046
log::version().debug("Compacting incomplete symbol {}", stream_id);
10471047

1048+
// INTENTIONAL
1049+
std::vector<int> use_after_move = {1, 2, 3};
1050+
std::vector<int> moved = std::move(use_after_move);
1051+
for (auto i : use_after_move) {
1052+
std::cout<<i<<std::endl;
1053+
}
1054+
1055+
int* use_after_free = new int(0);
1056+
delete use_after_free;
1057+
std::cout<<*use_after_free<<std::endl;
1058+
10481059
auto update_info = get_latest_undeleted_version_and_next_version_id(store(), version_map(), stream_id);
10491060
auto pipeline_context = std::make_shared<PipelineContext>();
10501061
pipeline_context->stream_id_ = stream_id;

cpp/arcticdb/version/version_core.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,18 @@ VersionedItem compact_incomplete_impl(
17781778
std::optional<SegmentInMemory> last_indexed;
17791779
std::optional<SortedValue> previous_sorted_value;
17801780

1781+
// INTENTIONAL
1782+
std::vector<int> use_after_move = {1, 2, 3};
1783+
std::vector<int> moved = std::move(use_after_move);
1784+
for (auto i : use_after_move) {
1785+
std::cout<<i<<std::endl;
1786+
}
1787+
1788+
int* use_after_free = new int(0);
1789+
delete use_after_free;
1790+
std::cout<<*use_after_free<<std::endl;
1791+
1792+
17811793
if(options.append_ && update_info.previous_index_key_.has_value()) {
17821794
read_indexed_keys_to_pipeline(store, pipeline_context, *(update_info.previous_index_key_), read_query, read_options);
17831795
if (!write_options.dynamic_schema) {

0 commit comments

Comments
 (0)