-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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 overflow in memcpy #2859
Closed
Closed
Fix overflow in memcpy #2859
Conversation
This file contains 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
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
In function ‘memcpy’, inlined from ‘control_msg_serialize.constprop’ at ../app/src/control_msg.c:77:5, inlined from ‘run_controller’ at ../app/src/controller.c:69:12: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: warning: ‘__builtin___memcpy_chk’ writing 262138 bytes into a region of size 262130 overflows the destination [-Wstringop-overflow=] return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
npes87184
force-pushed
the
fix_build_warning
branch
from
December 4, 2021 03:17
3c9a74a
to
d402ee9
Compare
LGTM 👍 How did you detect it in practice? It may occur only on very specific text size... |
It was detected by compiler. 😉 |
Which compiler? I tested with both gcc and clang, I don't get this warning. Any specific options? |
rom1v
pushed a commit
that referenced
this pull request
Dec 4, 2021
In function ‘memcpy’, inlined from ‘control_msg_serialize.constprop’ at ../app/src/control_msg.c:77:5, inlined from ‘run_controller’ at ../app/src/controller.c:69:12: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: warning: ‘__builtin___memcpy_chk’ writing 262138 bytes into a region of size 262130 overflows the destination [-Wstringop-overflow=] return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); Refs 901d837 PR #2859 <#2859> Signed-off-by: Yu-Chen Lin <npes87184@gmail.com> Signed-off-by: Romain Vimont <rom@rom1v.com>
I use gcc.
The detection option is Would it relate to the meson? |
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.
When serialize
CONTROL_MSG_TYPE_SET_CLIPBOARD
event, it did not consider the size of sequence which is 8 bytes. So that the buffer size is not enough for memcpy.