[all-commits] [llvm/llvm-project] 3c0910: [clangd] Sanity-check array sizes read from disk b...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Nov 11 14:17:15 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c09103291686630564c1ff3f78c0f8dc69d069f
      https://github.com/llvm/llvm-project/commit/3c09103291686630564c1ff3f78c0f8dc69d069f
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-11-11 (Wed, 11 Nov 2020)

  Changed paths:
    M clang-tools-extra/clangd/index/Serialization.cpp
    M clang-tools-extra/clangd/unittests/SerializationTests.cpp

  Log Message:
  -----------
  [clangd] Sanity-check array sizes read from disk before allocating them.

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.

Differential Revision: https://reviews.llvm.org/D91258




More information about the All-commits mailing list