Skip to content

Commit

Permalink
JACOBIN-641 (trap ByteArrayInputStream), JACOBIN-644 (Integer.decode)…
Browse files Browse the repository at this point in the history
… PR #274 from texadactyl

JACOBIN-641 (trap ByteArrayInputStream), JACOBIN-644 (Integer.decode)
  • Loading branch information
platypusguy authored Jan 30, 2025
2 parents b41b83b + f799722 commit 3023e04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/gfunction/Traps.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ func Load_Traps() {
GFunction: trapClass,
}

MethodSignatures["java/io/ByteArrayInputStream.<clinit>()V"] =
GMeth{
ParamSlots: 0,
GFunction: trapClass,
}

MethodSignatures["java/io/ByteArrayOutputStream.<clinit>()V"] =
GMeth{
ParamSlots: 0,
GFunction: trapClass,
}

MethodSignatures["java/io/CharArrayReader.<clinit>()V"] =
GMeth{
ParamSlots: 0,
Expand Down
6 changes: 4 additions & 2 deletions src/gfunction/javaLangInteger.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,14 @@ func integerDecode(params []interface{}) interface{} {
}

// Replace a leading "#" with "0x" in strArg.
wbase := 10
if strings.HasPrefix(strArg, "#") {
strArg = strings.Replace(strArg, "#", "0x", 1)
wbase = 16
strArg = strArg[1:]
}

// Parse the input integer.
int64Value, err := strconv.ParseInt(strArg, 10, 64)
int64Value, err := strconv.ParseInt(strArg, wbase, 64)
if err != nil {
errMsg := fmt.Sprintf("strconv.ParseInt(%s,10,64) failed, failed, reason: %s", strArg, err.Error())
return getGErrBlk(excNames.NumberFormatException, errMsg)
Expand Down

0 comments on commit 3023e04

Please sign in to comment.