Skip to content

Commit 3f938fc

Browse files
committed
Avoid an undefined-behaviour warning with -fsanitize=undefined.
1 parent 64b5b9f commit 3f938fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

semantic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,12 +507,13 @@ static cc_bool FindMacroParameter(const char* const remaining_line, const char*
507507
for (;;)
508508
{
509509
other_parameter_position = strstr(other_parameter_end, identifier);
510-
other_parameter_end = other_parameter_position + strlen(identifier);
511510

512511
/* Obviously bail if the identifier wasn't found. */
513512
if (other_parameter_position == NULL)
514513
break;
515514

515+
other_parameter_end = other_parameter_position + strlen(identifier);
516+
516517
/* If the identifier was in the middle of a larger block of letters/numbers, then don't replace it. */
517518
/* (This is what AS does, and the Sonic 1 disassembly relies on this). */
518519
if ((other_parameter_position == remaining_line || !IsMacroBlockingCharacter(other_parameter_position[-1])) && !IsMacroBlockingCharacter(other_parameter_end[0]))

0 commit comments

Comments
 (0)