llvm-project/llvm/test/tools/llvm-cvtres
Bob Haarman ea5ff9fa6b Fix buffer overrun in WindowsResourceCOFFWriter::writeSymbolTable()
Summary:
We were using sprintf(..., "$R06X", <some uint32_t>) to create strings
that are expected to be exactly length 8, but this results in longer
strings if the uint32_t is greater than 0xffffff. This change modifies
the behavior as follows:

 - Uses the loop counter instead of the data offset. This gives us
   sequential symbol names, avoiding collisions as much as possible.

 - Masks the value to 0xffffff to avoid generating names longer than 8
   bytes.

 - Uses formatv instead of sprintf.

Fixes PR35581.

Reviewers: ruiu, zturner

Reviewed By: ruiu

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 321030
2017-12-18 22:10:14 +00:00
..
Inputs Update the test framework for llvm-cvtres to be more comprehensive. 2017-06-13 00:16:32 +00:00
combined.test Re-enable tests on power pc since the bug has been fixed. 2017-06-14 00:22:43 +00:00
help.test Update the test framework for llvm-cvtres to be more comprehensive. 2017-06-13 00:16:32 +00:00
machine.test Fix buffer overrun in WindowsResourceCOFFWriter::writeSymbolTable() 2017-12-18 22:10:14 +00:00
object.test Re-enable tests on power pc since the bug has been fixed. 2017-06-14 00:22:43 +00:00
parse.test Read /out:%t which was (accidentally?) removed in r305258. 2017-06-13 07:00:05 +00:00
symbols.test Fix buffer overrun in WindowsResourceCOFFWriter::writeSymbolTable() 2017-12-18 22:10:14 +00:00