Skip to content

Commit

Permalink
Checking in actual fix for #146
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 11, 2014
1 parent ca94baf commit 9bf8284
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ private final JsonToken _parseFloat(int ch, int startPtr, int ptr, boolean neg,
if (ch == INT_MINUS || ch == INT_PLUS) { // yup, skip for now
if (ptr >= inputLen) {
_inputPtr = startPtr;
return _parseNumber2(false, startPtr);
return _parseNumber2(neg, startPtr);
}
ch = (int) _inputBuffer[ptr++];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fasterxml.jackson.core.main;

import java.io.CharArrayReader;
import java.io.*;

import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.io.NumberInput;
Expand Down Expand Up @@ -83,7 +83,7 @@ public void testLongBoundsChecks() throws Exception
assertFalse(NumberInput.inLongRange(cbuf, 0, cbuf.length, false));
}

public void testFloatBoundary146() throws Exception
public void testFloatBoundary146Chars() throws Exception
{
final char[] arr = new char[50005];
final JsonFactory f = new JsonFactory();
Expand All @@ -100,4 +100,22 @@ public void testFloatBoundary146() throws Exception
p.close();
}
}

public void testFloatBoundary146Bytes() throws Exception
{
final byte[] arr = new byte[50005];
final JsonFactory f = new JsonFactory();
for(int i = 500; i != 9000; ++i) {
java.util.Arrays.fill(arr, 0, i, (byte) 0x20);
arr[i] = '-';
arr[i + 1] = '1';
arr[i + 2] = 'e';
arr[i + 3] = '-';
arr[i + 4] = '1';
ByteArrayInputStream in = new ByteArrayInputStream(arr, 0, i+5);
JsonParser p = f.createParser(in);
assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken());
p.close();
}
}
}

0 comments on commit 9bf8284

Please sign in to comment.