Skip to content

Two patches #38

@nomota

Description

@nomota

I was translating to C3 language and found these two bugs.

slre.c: 322 line, change this

  int i, result = -1, is_anchored = info->brackets[0].ptr[0] == '^';

as follows

  int result = -1;
  bool is_anchored = (info.brackets[0].ptr[0] == '^') || (info.brackets[0].ptr[0] == '(' && info.brackets[0].ptr[1] == '^');

to pass this test

  ASSERT(slre_match("(^o)", "fooklmn", 7, NULL, 0, 0) == SLRE_NO_MATCH);

slre.c: 387 line, add following

     FAIL_IF(i >= re_len - 1, SLRE_INVALID_METACHARACTER);

      if (i >= (re_len - 2)) {
        if (re[i+1] == ')') {
          if (info.brackets[info.num_brackets-1].len == -1) {
            return INVALID_METACHARACTER;
          }
        }
      }

to pass this test

  ASSERT(slre_match("(\\)", "a", 1, NULL, 0, 0) == SLRE_INVALID_METACHARACTER);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions