Browse Source

Merge pull request #9592 in CORE/base-third from bugfix/10.0 to feature/10.0

* commit 'fe46e5f6e76c81decbb8aec276dfc33e35745606':
  REPORT-103466 导出负载高
feature/10.0
superman 1 year ago
parent
commit
1878b5df06
  1. 11
      fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/pdf/ByteBuffer.java

11
fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/pdf/ByteBuffer.java

@ -82,6 +82,7 @@ public class ByteBuffer extends OutputStream {
*/ */
public static boolean HIGH_PRECISION = false; public static boolean HIGH_PRECISION = false;
private static final DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); private static final DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
private static final int HALF_INTEGER = Integer.MAX_VALUE >> 1;
/** Creates new ByteBuffer with capacity 128 */ /** Creates new ByteBuffer with capacity 128 */
public ByteBuffer() { public ByteBuffer() {
@ -188,8 +189,11 @@ public class ByteBuffer extends OutputStream {
*/ */
public ByteBuffer append_i(int b) { public ByteBuffer append_i(int b) {
int newcount = count + 1; int newcount = count + 1;
if (newcount < 0) {
throw new OutOfMemoryError();
}
if (newcount > buf.length) { if (newcount > buf.length) {
byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)]; byte newbuf[] = new byte[Math.max(Math.min(buf.length, HALF_INTEGER) << 1, newcount)];
System.arraycopy(buf, 0, newbuf, 0, count); System.arraycopy(buf, 0, newbuf, 0, count);
buf = newbuf; buf = newbuf;
} }
@ -211,8 +215,11 @@ public class ByteBuffer extends OutputStream {
((off + len) > b.length) || ((off + len) < 0) || len == 0) ((off + len) > b.length) || ((off + len) < 0) || len == 0)
return this; return this;
int newcount = count + len; int newcount = count + len;
if (newcount < 0) {
throw new OutOfMemoryError();
}
if (newcount > buf.length) { if (newcount > buf.length) {
byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)]; byte newbuf[] = new byte[Math.max(Math.min(buf.length, HALF_INTEGER) << 1, newcount)];
System.arraycopy(buf, 0, newbuf, 0, count); System.arraycopy(buf, 0, newbuf, 0, count);
buf = newbuf; buf = newbuf;
} }

Loading…
Cancel
Save