Commit cd471b26 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/84831 (Invalid memory read in parse_output_constraint)

	PR middle-end/84831
	* stmt.c (parse_output_constraint): If the CONSTRAINT_LEN (*p, p)
	characters starting at p contain '\0' character, don't look beyond
	that.

From-SVN: r258478
parent ee6e1303
2018-03-13 Jakub Jelinek <jakub@redhat.com> 2018-03-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/84831
* stmt.c (parse_output_constraint): If the CONSTRAINT_LEN (*p, p)
characters starting at p contain '\0' character, don't look beyond
that.
PR target/84827 PR target/84827
* config/i386/i386.md (round<mode>2): For 387 fancy math, disable * config/i386/i386.md (round<mode>2): For 387 fancy math, disable
pattern if -ftrapping-math -fno-fp-int-builtin-inexact. pattern if -ftrapping-math -fno-fp-int-builtin-inexact.
......
...@@ -247,7 +247,8 @@ parse_output_constraint (const char **constraint_p, int operand_num, ...@@ -247,7 +247,8 @@ parse_output_constraint (const char **constraint_p, int operand_num,
} }
/* Loop through the constraint string. */ /* Loop through the constraint string. */
for (p = constraint + 1; *p; p += CONSTRAINT_LEN (*p, p)) for (p = constraint + 1; *p; )
{
switch (*p) switch (*p)
{ {
case '+': case '+':
...@@ -304,6 +305,11 @@ parse_output_constraint (const char **constraint_p, int operand_num, ...@@ -304,6 +305,11 @@ parse_output_constraint (const char **constraint_p, int operand_num,
break; break;
} }
for (size_t len = CONSTRAINT_LEN (*p, p); len; len--, p++)
if (*p == '\0')
break;
}
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment