check num_values in pg_aod_sketch_union_agg#78
check num_values in pg_aod_sketch_union_agg#78AlexanderSaydakov merged 1 commit intoapache:masterfrom
Conversation
|
something is wrong with our build: |
3238c48 to
92c1822
Compare
92c1822 to
5dbd347
Compare
|
@AlexanderSaydakov |
|
It is good that you found a workaround, but I am still confused as to why this clang-19 is invoked. I see that some make steps run gcc or g++. How does this happen? |
|
@AlexanderSaydakov I have tested with an empty commit, triggered the make error as well. So the error does not come from code changes. |
|
I understand that it is not our code. I wonder how exactly make invokes clang-19. perhaps, pg_config suggests this here: I am inclined to proceed with this fix for now. |
|
Thanks |



Context
This PR is a follow-up of #77
The test
aod_sketch_test.sqlfailed at line 25 withSegmentation faultThe issue stems from a misuse of the aod_sketch_union function. In the following line:
The original intention was to set
lgkto 16. However, the second argument ofaod_sketch_unionis actuallynum_values. The test tableaod_sketch_testwas initialized with sketches havingnum_values = 1(array[1]), as shown below:Passing 16 as
num_values results in out-of-bounds access during the union operation, which is an undefined behavior. In our tests running on OEL7, this corrupted the array and triggered a segmentation fault. Below is the code of out-of-bound array access:Changes
num_valueschecks inpg_aod_sketch_union_aggTestings
If we pass an out-of-bound num_values
Appendix
I have added a few log lines around the
aod_union_update. Before the union operation, I could iterate over the sketch and print out its values. After the update, iterating over the sketch will produceSegmentation Fault