-
Notifications
You must be signed in to change notification settings - Fork 1k
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
make operator new more standard compliant #295
Comments
Reported by |
Reported by |
Reported by |
Reported by |
Reported by |
Reported by |
I've just spent many many hours ensuring the libstdc++ testsuite can run with sanitizers, and all our code for handling allocation failure is untestable due to this issue. Every test that tries to handle This makes ASan unusable for testing large pieces of the C++ standard library. |
And to be clear,
is inaccurate, it directly violates an absolute requirement of the standard. That's not just a case of being "not fully standard-compliant". |
We would be happy to accept small incremental patches fixing the problem piece-by-piece, |
I tried to make a patch to compiler-rt to fix this, but ran into the fact that you build w/exceptions disabled. |
And the libstdc++ maintainer. |
mclow@, yes, we will need to change the build rules to build a small part of run-time w/ exceptions. |
Do we really need to enable exceptions? Can't we just call __cxa_throw from __asan_new? |
And For libstdc++ you can call |
I'd be happy to make libc++ provide a |
A solution that will not require us to change the build flags is more welcome of course. |
Actually, libc++ already has a |
It'd be cool if there was a way to set allocator_may_return_null=1 only for new (std::nothrow). In Chromium, we like regular operator new to crash, but we'd like nothrow new to return 0. We currently disable at least one test in asan mode because it catches nothrow new that would return 0. |
(sorry for delay... yes, I afraid we need to do that) |
Awfully belated update, everything requested (except throwing std::bad_alloc) is implemented as of July 2017. |
That's encouraging.
Is that correct? |
(and thanks for the update!) |
Ah, the new_handler, indeed... So, to recap. With allocator_may_return_null=0, allocator always crashes on failure, the rest assumes allocator_may_return_null=1
TODO:
|
Bug: none Change-Id: Ib11ae467efea7ce3a44375850ddbf78524914aef Reviewed-on: https://chromium-review.googlesource.com/996853 Reviewed-by: Hans Wennborg <[email protected]> Commit-Queue: Nico Weber <[email protected]> Cr-Commit-Position: refs/heads/master@{#548405}
And an MSVC STL maintainer. |
Nice to see MSVC joining the party. :-) |
FWIW, not just C++ STL developers. This effectively makes [oss-]fuzzing code |
To be more searchable.
To be more searchable.
Originally reported on Google Code with ID 295
Reported by
konstantin.s.serebryany
on 2014-04-15 12:00:10The text was updated successfully, but these errors were encountered: