[all-commits] [llvm/llvm-project] 3c123a: [yaml2obj] - Introduce a 10 Mb limit of the output...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Wed Jun 10 05:24:39 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c123acf57cb21faed327d7f36a1146875c67319
      https://github.com/llvm/llvm-project/commit/3c123acf57cb21faed327d7f36a1146875c67319
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-06-10 (Wed, 10 Jun 2020)

  Changed paths:
    M llvm/include/llvm/ObjectYAML/yaml2obj.h
    M llvm/lib/ObjectYAML/ELFEmitter.cpp
    M llvm/lib/ObjectYAML/yaml2obj.cpp
    A llvm/test/tools/yaml2obj/ELF/output-limit.yaml
    M llvm/tools/yaml2obj/yaml2obj.cpp

  Log Message:
  -----------
  [yaml2obj] - Introduce a 10 Mb limit of the output by default and a --max-size option.

Multiple times we faced an issue of huge outputs due to unexpected behavior
or incorrect test cases. The last one was https://reviews.llvm.org/D80629#2073066.

This patch limits the output to 10 Mb for ELF and introduces the --max-size to change this
limit.

I've tried to keep the implementation non-intrusive.

The current logic we have is that we prepare section content in a buffer first and write
it to the output later. This patch checks the available limit on each writing attempt to this buffer
and stops writing when the limit is reached and raises the internal error flag.
Later, this flag is is checked before the actual writing to a file happens and
an error is reported.

Differential revision: https://reviews.llvm.org/D81258




More information about the All-commits mailing list