Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 382999dec5da
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4c1566b1dca7
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Mar 6, 2015

  1. Copy the full SHA
    8156128 View commit details
  2. Merge pull request #2653 from bjfish/truffle-regex-singe-hex-parse

    [Truffle] Fixing a parse error in single character regex hex
    chrisseaton committed Mar 6, 2015
    Copy the full SHA
    4c1566b View commit details
Showing with 15 additions and 2 deletions.
  1. +15 −2 truffle/src/main/java/org/jruby/truffle/translator/BodyTranslator.java
Original file line number Diff line number Diff line change
@@ -2422,13 +2422,26 @@ public static boolean all7Bit(byte[] bytes) {
}

if (bytes[n] == '\\' && n + 1 < bytes.length && bytes[n + 1] == 'x') {
int b = Integer.parseInt(new String(Arrays.copyOfRange(bytes, n + 2, n + 4), StandardCharsets.UTF_8), 16);
final String num;
final boolean isSecondHex = n + 3 < bytes.length && Character.digit(bytes[n + 3], 16) != -1;
if (isSecondHex) {
num = new String(Arrays.copyOfRange(bytes, n + 2, n + 4), StandardCharsets.UTF_8);
} else {
num = new String(Arrays.copyOfRange(bytes, n + 2, n + 3), StandardCharsets.UTF_8);
}

int b = Integer.parseInt(num, 16);

if (b > 0x7F) {
return false;
}

n += 3;
if (isSecondHex) {
n += 3;
} else {
n += 2;
}

}
}