-
Notifications
You must be signed in to change notification settings - Fork 12.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
std::ptr::copy_nonoverlapping failing on windows #126687
Labels
C-gub
Category: the reverse of a compiler bug is generally UB
Comments
Based on the current contents of the issue description, my best guess is that this is UB in your code, not a compiler bug. We have had a few similar reports recently. If you can share enough code to reproduce the crash on 1.79, we can figure out what's going on here. |
std::ptr::copy_nonoverlapping(pSess, session_id_buf.as_mut_ptr() as *mut bindings::Session, session_id_buf.len()); This line looks wrong. The count is the number of items, not the byte size. |
@ChrisDenton Yes, that seems to be it. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a rust program that is compiled as a dll. This dll is then loaded by a 3rd party app.
Part of the process is creating "sessions" for the 3rd party app. For that it gives you a void pointer and basically tells you "write whatever you want in here, we won't try to read it, just give it back with each subsequent call". So for simplicity, I figured out I'd just have a uint32 session id and write it to the pointer, and read it back when given (code below).
This workes fine on
1.77.0
, but crashes the 3rd party app on1.79.0
, one what seems like a memory violation.Writing the session id:
Reading back the session id:
Version it worked on
It most recently worked on: 1.78.0
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: