[PATCH] D91258: [clangd] Sanity-check array sizes read from disk before allocating them.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 11 06:54:34 PST 2020
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: cfe-commits, usaxena95, arphaman.
Herald added a project: clang.
sammccall requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
Previously a corrupted index shard could cause us to resize arrays to an
arbitrary int32. This tends to be a huge number, and can render the
system unresponsive.
Instead, cap this at the amount of data that might reasonably be read
(e.g. the #bytes in the file). If the specified length is more than that,
assume the data is corrupt.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D91258
Files:
clang-tools-extra/clangd/index/Serialization.cpp
clang-tools-extra/clangd/unittests/SerializationTests.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91258.304505.patch
Type: text/x-patch
Size: 7120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201111/5c0e374d/attachment.bin>
More information about the cfe-commits
mailing list