[all-commits] [llvm/llvm-project] 4ec0b0: [obj2yaml] - Stop triggering UB when dumping corru...

llvm-git-migration via All-commits all-commits at lists.llvm.org
Mon Oct 21 03:36:52 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ec0b084389619442638d7d3563793f21d787501
      https://github.com/llvm/llvm-project/commit/4ec0b084389619442638d7d3563793f21d787501
  Author: George Rimar <grimar at accesssoftek.com>
  Date:   2019-10-21 (Mon, 21 Oct 2019)

  Changed paths:
    M llvm/include/llvm/Support/YAMLTraits.h
    A llvm/test/tools/obj2yaml/invalid-section-name.yaml

  Log Message:
  -----------
  [obj2yaml] - Stop triggering UB when dumping corrupted strings.

We have a following code to find quote type:

if (isspace(S.front()) || isspace(S.back()))
...

Problem is that:

"int isspace( int ch ): The behavior is undefined if the value of
ch is not representable as unsigned char and is not equal to EOF."
(https://en.cppreference.com/w/cpp/string/byte/isspace)

This patch shows how this UB can be triggered and fixes an issue.

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

llvm-svn: 375404




More information about the All-commits mailing list