-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
MemoryBufferTest.MoveCtor provokes undefined sanitizer #1344
Comments
Good catch. The test should really create a new buffer before doing the dynamic allocation part. |
orivej
added a commit
to orivej/fmt
that referenced
this issue
Oct 8, 2019
When `MoveCtor` performs `check_move_buffer`, the buffer allocator becomes null, but then `MoveCtor` attempts to use it to allocate a dynamic buffer. This succeeds nevertheless because a typical `std::allocator<char>::allocate` does not use `this`, so it does not crash when `this` is null. Fixes fmtlib#1344
orivej
added a commit
to orivej/fmt
that referenced
this issue
Oct 8, 2019
When `MoveCtor` performs `check_move_buffer`, the buffer allocator becomes null, but then `MoveCtor` attempts to use it to allocate a dynamic buffer. This succeeds nevertheless because a typical `std::allocator<char>::allocate` does not use `this`, so it does not crash when `this` is null. Fixes fmtlib#1344
vitaut
pushed a commit
that referenced
this issue
Oct 8, 2019
When `MoveCtor` performs `check_move_buffer`, the buffer allocator becomes null, but then `MoveCtor` attempts to use it to allocate a dynamic buffer. This succeeds nevertheless because a typical `std::allocator<char>::allocate` does not use `this`, so it does not crash when `this` is null. Fixes #1344
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When
MoveCtor
performscheck_move_buffer
, the buffer allocator becomes null as expected, but thenMoveCtor
attempts to use it to allocate a dynamic buffer. UBSAN reports this as a reference binding to a null pointer at TestAllocator.allocate. I think that this succeeds nevertheless because a typicalstd::allocator<char>::allocate
does not usethis
, so it does not crash whenthis
is null.The text was updated successfully, but these errors were encountered: