This reverts r254234, and adds a simple fix for the annoying case of use-after-free.
Details
Details
Diff Detail
Diff Detail
Event Timeline
| lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp | ||
|---|---|---|
| 257 | This looks like too big a hammer... Where is the pattern that breaks? | |
| lib/Target/ARM/ARMAsmPrinter.cpp | ||
|---|---|---|
| 622 | Here we're passing a reference to a local std::string to the ATS, which stays alive after this function returns, and keeps a reference to the deleted string. | |
| lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp | ||
| 257 | I'd argue that this was a bug that went unnoticed for a very long while... (see below) | |
Comment Actions
LGTM. Thanks!
| lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp | ||
|---|---|---|
| 257 | Good point. If they need to keep the value until after the call, then they need to be copied every time. | |
Here we're passing a reference to a local std::string to the ATS, which stays alive after this function returns, and keeps a reference to the deleted string.