-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix](mem) heap-buffer-overflow for function convert_to #46405
Conversation
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
run buildall |
TeamCity be ut coverage result: |
be/src/clucene
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that this file should not be updated in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks
d940ac5
to
c22c243
Compare
run buildall |
TPC-H: Total hot run time: 32346 ms
|
TPC-DS: Total hot run time: 190695 ms
|
ClickBench: Total hot run time: 31.47 s
|
TeamCity be ut coverage result: |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
### What problem does this PR solve? Reproduce SQL with ASAN version: `select convert('装装装装装' using gbk);` Then be crashed: ``` ================================================================= ==1830466==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x606002aeec20 at pc 0x560826fb3e66 bp 0x7fc3816a5890 sp 0x7fc3816a5058 WRITE of size 10 at 0x606002aeec20 thread T711 (brpc_light) ``` But if we use release version, we found the result is not correct, and the memory maybe already corrupted: ``` > select convert('装装装装装' using gbk); +---------------------------------------------------------+ | convert_to('装装装装装', 'gbk') | +---------------------------------------------------------+ | ~zhuangdang~zhuangdang~zhuangdang~zhuangdang~zhu | +---------------------------------------------------------+ 1 row in set (0.04 sec) ``` The correct answer should be: ``` > select convert('装装装装装' using gbk); +--------------------------------------+ | convert_to('装装装装装', 'gbk') | +--------------------------------------+ | ~zhuang~zhuang~zhuang~zhuang~zhuang | +--------------------------------------+ 1 row in set (0.06 sec) ```
Reproduce SQL with ASAN version: `select convert('装装装装装' using gbk);` Then be crashed: ``` ================================================================= ==1830466==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x606002aeec20 at pc 0x560826fb3e66 bp 0x7fc3816a5890 sp 0x7fc3816a5058 WRITE of size 10 at 0x606002aeec20 thread T711 (brpc_light) ``` But if we use release version, we found the result is not correct, and the memory maybe already corrupted: ``` > select convert('装装装装装' using gbk); +---------------------------------------------------------+ | convert_to('装装装装装', 'gbk') | +---------------------------------------------------------+ | ~zhuangdang~zhuangdang~zhuangdang~zhuangdang~zhu | +---------------------------------------------------------+ 1 row in set (0.04 sec) ``` The correct answer should be: ``` > select convert('装装装装装' using gbk); +--------------------------------------+ | convert_to('装装装装装', 'gbk') | +--------------------------------------+ | ~zhuang~zhuang~zhuang~zhuang~zhuang | +--------------------------------------+ 1 row in set (0.06 sec) ```
What problem does this PR solve?
Reproduce SQL with ASAN version:
select convert('装装装装装' using gbk);
Then be crashed:
But if we use release version, we found the result is not correct, and the memory maybe already corrupted:
The correct answer should be:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)