[all-commits] [llvm/llvm-project] c26729: clang-format: [JS] fix uninitialized memory.
Martin Probst via All-commits
all-commits at lists.llvm.org
Fri Jan 28 03:38:19 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c26729251588cb6e9e20c3edf67d14ac9b549f9b
https://github.com/llvm/llvm-project/commit/c26729251588cb6e9e20c3edf67d14ac9b549f9b
Author: Martin Probst <martin at probst.io>
Date: 2022-01-28 (Fri, 28 Jan 2022)
Changed paths:
M clang/lib/Format/SortJavaScriptImports.cpp
Log Message:
-----------
clang-format: [JS] fix uninitialized memory.
SortJavaScriptImports attempts to set its currently parsed token to an
invalid token when it reaches the end of the line. However in doing so,
it used a `FormatToken`, which contains a `Token Tok`. `Token` does not
have a constructor, so its fields start out as uninitialized memory.
`Token::startToken()` initializes all fields. Calling it in
`JavaScriptImportSorter`'s constructor thus fixes the problem.
Differential Revision: https://reviews.llvm.org/D118448
More information about the All-commits
mailing list