This is an archive of the discontinued LLVM Phabricator instance.

Fix use after free in DiskFilesOrDirectories
ClosedPublic

Authored by teemperor on Jan 20 2018, 11:35 PM.

Details

Summary

We copy the local variable Resolved into Storage to keep it around. However, we then still let the SearchDir ref point to Resolved which then is used to access the already freed memory later on. With this patch we point to Storage which doesn't get deleted after the current scope exits.

Discovered by memory sanitizer in the CompletionTest.DirCompletionUsername test.

Diff Detail

Repository
rL LLVM

Event Timeline

teemperor created this revision.Jan 20 2018, 11:35 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 22 2018, 1:19 AM
This revision was automatically updated to reflect the committed changes.