Skip to content

Commit 44c133c

Browse files
committed
Fixed a potential problem with __label__ used in calculations. Hopefully fixes Github issue #482.
1 parent c5e3ee2 commit 44c133c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

stack.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -812,8 +812,8 @@ static int _stack_calculate(char *in, int *value, int *bytes_parsed, unsigned ch
812812
return FAILED;
813813
}
814814
else {
815-
/* it must be a string! */
816-
int is_string = YES, is_already_processed_function = NO;
815+
/* it must be a label! */
816+
int is_label = YES, is_already_processed_function = NO;
817817

818818
/* we'll break if the previous item in the stack was a value or a string / label */
819819
if (_break_before_value_or_string(q, &si[0]) == SUCCEEDED)
@@ -855,7 +855,7 @@ static int _stack_calculate(char *in, int *value, int *bytes_parsed, unsigned ch
855855
if (parse_function_asc(in, &d, &parsed_chars) == FAILED)
856856
return FAILED;
857857
in += parsed_chars;
858-
is_string = NO;
858+
is_label = NO;
859859
break;
860860
}
861861
if (k == 7 && strcaselesscmpn(si[q].string, "defined(", 8) == 0) {
@@ -864,7 +864,7 @@ static int _stack_calculate(char *in, int *value, int *bytes_parsed, unsigned ch
864864
if (parse_function_defined(in, &d, &parsed_chars) == FAILED)
865865
return FAILED;
866866
in += parsed_chars;
867-
is_string = NO;
867+
is_label = NO;
868868
break;
869869
}
870870
if (k == 6 && strcaselesscmpn(si[q].string, "exists(", 7) == 0) {
@@ -873,7 +873,7 @@ static int _stack_calculate(char *in, int *value, int *bytes_parsed, unsigned ch
873873
if (parse_function_exists(in, &d, &parsed_chars) == FAILED)
874874
return FAILED;
875875
in += parsed_chars;
876-
is_string = NO;
876+
is_label = NO;
877877
break;
878878
}
879879
if (k == 6 && strcaselesscmpn(si[q].string, "lobyte(", 7) == 0) {
@@ -922,9 +922,9 @@ static int _stack_calculate(char *in, int *value, int *bytes_parsed, unsigned ch
922922

923923
if (is_already_processed_function == YES) {
924924
}
925-
else if (is_string == YES) {
926-
process_special_labels(si[q].string);
925+
else if (is_label == YES) {
927926
si[q].string[k] = 0;
927+
process_special_labels(si[q].string);
928928
si[q].type = STACK_ITEM_TYPE_LABEL;
929929
got_label = YES;
930930

0 commit comments

Comments
 (0)