[PATCH] D81258: [yaml2obj] - Introduce a ~10 Mb limit of the output by default and a --nolimit option.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 06:34:03 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

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 --nolimit to ignore 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.


https://reviews.llvm.org/D81258

Files:
  llvm/include/llvm/ObjectYAML/yaml2obj.h
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/lib/ObjectYAML/yaml2obj.cpp
  llvm/test/tools/yaml2obj/ELF/output-limit.yaml
  llvm/tools/yaml2obj/yaml2obj.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81258.268762.patch
Type: text/x-patch
Size: 30842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200605/e218a878/attachment.bin>


More information about the llvm-commits mailing list