[PATCH] D124915: Check for resource exhaustion when recursively parsing declarators

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 4 05:02:36 PDT 2022


aaron.ballman created this revision.
aaron.ballman added reviewers: erichkeane, rsmith, rjmccall.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.

With sufficiently tortured code, it's possible to cause a stack overflow when parsing declarators. Thus, we now check for resource exhaustion when recursively parsing declarators so that we can at least warn the user we're about to crash before we actually crash.

This fixes https://github.com/llvm/llvm-project/issues/51642.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124915

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Parse/Parser.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/Parser.cpp
  clang/test/Parser/declarators-recursion-crash.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124915.426964.patch
Type: text/x-patch
Size: 5293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220504/d2e9dda6/attachment.bin>


More information about the cfe-commits mailing list