Skip to content

Davey: use-after-free with std::stringΒ #1312

@FaultyPine

Description

@FaultyPine

In the davey tool, there's lots of occurances of type.name() ? type.name() : std::string{storage->info().name()}.data()
In the second case, the std::string is constructed, we take the .data() ptr, then that temporary is destructed, and assigned to a label which is now displaying freed memory.
On my local PC, that ends up with the davey output displaying random letters instead of the actual component names.
Changing these sites to use storage->info().name().data() worked for me locally, since .name() is a string_view.

Unrelated, but davey also does #include "Imgui.h" which can cause compiler errors for some projects.
Might be good to either not include it at all, and depend on the file including davey to also have imgui in scope, or add a macro that can compile that include out for people who want to use a different "include path" for imgui. Maybe this should be a separate issue, but it seemed minor enough i thought i'd just include it here

Metadata

Metadata

Assignees

Labels

enhancementaccepted requests, sooner or later I'll do itsolvedavailable upstream or in a branch

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions