Commit d6315a2
authored
[clang][BufferUsage] Fix a StringRef lifetime issue (#159109)
The code before assigned the `std::string` returned from
`tryEvaluateString()` to the `StringRef`, but it was possible that the
underlying data of that string vanished in the meantime, passing invalid
stack memory to `ParsePrintfString`.
Fix this by using two different code paths for the `getCharByteWidth()
== 1` case and the `tryEvaluateString()` one.1 parent 1c2d7b3 commit d6315a2
1 file changed
+13
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
903 | | - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
904 | 906 | | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
913 | 911 | | |
914 | | - | |
915 | | - | |
916 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
917 | 918 | | |
918 | | - | |
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
| |||
0 commit comments