This is an archive of the discontinued LLVM Phabricator instance.

clang-format: [JS] fix uninitialized memory.
ClosedPublic

Authored by mprobst on Jan 28 2022, 3:18 AM.

Details

Summary

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.

Diff Detail

Event Timeline

mprobst requested review of this revision.Jan 28 2022, 3:18 AM
mprobst created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2022, 3:18 AM
krasimir accepted this revision.Jan 28 2022, 3:21 AM
This revision is now accepted and ready to land.Jan 28 2022, 3:21 AM
This revision was landed with ongoing or failed builds.Jan 28 2022, 3:38 AM
This revision was automatically updated to reflect the committed changes.