[llvm] [Support] Fix buffer overflow in regcomp (PR #76681)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 1 07:29:07 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 463dad107f4cb60ae1d49138143d6797599fb1fb 22fcd1ef7e9a79a861313bc0f2d4c84767e2a0e8 -- llvm/lib/Support/regcomp.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Support/regcomp.c b/llvm/lib/Support/regcomp.c
index 1f68008d6a..08ef1adcc5 100644
--- a/llvm/lib/Support/regcomp.c
+++ b/llvm/lib/Support/regcomp.c
@@ -1601,9 +1601,9 @@ findmust(struct parse *p, struct re_guts *g)
sop s;
char *cp;
sopno i;
- unsigned int skipsize;
+ unsigned int skipsize;
- /* avoid making error situations worse */
+ /* avoid making error situations worse */
if (p->error != 0)
return;
@@ -1626,17 +1626,17 @@ findmust(struct parse *p, struct re_guts *g)
case OCH_:
scan--;
do {
- /* Ensure end is not skipped */
- skipsize = OPND(s);
- while (skipsize > 0) {
- if (OP(*scan) == OEND) {
- g->iflags |= REGEX_BAD;
- return;
- }
- scan++;
- skipsize--;
- }
- s = *scan;
+ /* Ensure end is not skipped */
+ skipsize = OPND(s);
+ while (skipsize > 0) {
+ if (OP(*scan) == OEND) {
+ g->iflags |= REGEX_BAD;
+ return;
+ }
+ scan++;
+ skipsize--;
+ }
+ s = *scan;
/* assert() interferes w debug printouts */
if (OP(s) != O_QUEST && OP(s) != O_CH &&
OP(s) != OOR2) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/76681
More information about the llvm-commits
mailing list