You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2019/01/08 07:07:56 UTC
[commons-imaging] branch master updated (eb98398 -> 0291af4)
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git.
from eb98398 Merge branch 'IMAGING-103'
add f5574bf IMAGING-219: prevent infinite loop when decompressing RGBE input file
new 470217e IMAGING-219: add changes.xml entry
new 9519e44 Merge branch 'IMAGING-219'
new 6a79d35 IMAGING-220: replace while by if in the JPEG decoder extend method
new 289ca5b IMAGING-220: add changes.xml entry
new 0291af4 Merge branch 'IMAGING-220'
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/changes/changes.xml | 6 ++++
.../imaging/formats/jpeg/decoder/JpegDecoder.java | 2 +-
.../commons/imaging/formats/rgbe/RgbeInfo.java | 6 +++-
.../JpegDecoderTest.java} | 34 ++++++++++++---------
.../commons/imaging/formats/rgbe/RgbeReadTest.java | 20 ++++++++++++
...imeout-9713502c9c371f1654b493650c16ab17c0444369 | Bin 0 -> 4000 bytes
...imeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78 | Bin 0 -> 932 bytes
7 files changed, 52 insertions(+), 16 deletions(-)
copy src/test/java/org/apache/commons/imaging/formats/jpeg/{JpegWithInvalidDhtSegmentTest.java => decoder/JpegDecoderTest.java} (51%)
create mode 100644 src/test/resources/IMAGING-219/timeout-9713502c9c371f1654b493650c16ab17c0444369
create mode 100644 src/test/resources/IMAGING-220/timeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78
[commons-imaging] 03/05: IMAGING-220: replace while by if in the
JPEG decoder extend method
Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 6a79d35d6654d895d0a4b73b3a9282ec9aaeeb06
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Wed Jan 2 21:00:32 2019 +1300
IMAGING-220: replace while by if in the JPEG decoder extend method
---
.../imaging/formats/jpeg/decoder/JpegDecoder.java | 2 +-
.../formats/jpeg/decoder/JpegDecoderTest.java | 47 +++++++++++++++++++++
...imeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78 | Bin 0 -> 932 bytes
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
index 3561fcb..2b21da2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
@@ -400,7 +400,7 @@ public class JpegDecoder extends BinaryFileParser implements JpegUtils.Visitor {
private int extend(int v, final int t) {
// "EXTEND", section F.2.2.1, figure F.12, page 105 of T.81
int vt = (1 << (t - 1));
- while (v < vt) {
+ if (v < vt) {
vt = (-1 << t) + 1;
v += vt;
}
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoderTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoderTest.java
new file mode 100644
index 0000000..20459a2
--- /dev/null
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoderTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.imaging.formats.jpeg.decoder;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
+import org.junit.Test;
+
+/**
+ * Tests for the JpegDecoder.
+ */
+public class JpegDecoderTest {
+
+ /**
+ * Test that a bad file does not hang or take too long to be processed.
+ *
+ * @throws IOException
+ * @throws ImageReadException
+ */
+ @Test(expected = ImageReadException.class, timeout = 2000)
+ public void testDecodeBadFile() throws ImageReadException, IOException {
+ // From IMAGING-220
+ File inputFile = new File(
+ JpegDecoderTest.class.getResource("/IMAGING-220/timeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78")
+ .getFile());
+ ByteSourceFile byteSourceFile = new ByteSourceFile(inputFile);
+ new JpegDecoder().decode(byteSourceFile);
+ }
+}
diff --git a/src/test/resources/IMAGING-220/timeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78 b/src/test/resources/IMAGING-220/timeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78
new file mode 100644
index 0000000..3092589
Binary files /dev/null and b/src/test/resources/IMAGING-220/timeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78 differ
[commons-imaging] 02/05: Merge branch 'IMAGING-219'
Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 9519e44ebf045fdc84262327e076556806aec932
Merge: eb98398 470217e
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Tue Jan 8 20:05:06 2019 +1300
Merge branch 'IMAGING-219'
src/changes/changes.xml | 3 +++
.../commons/imaging/formats/rgbe/RgbeInfo.java | 6 +++++-
.../commons/imaging/formats/rgbe/RgbeReadTest.java | 20 ++++++++++++++++++++
...timeout-9713502c9c371f1654b493650c16ab17c0444369 | Bin 0 -> 4000 bytes
4 files changed, 28 insertions(+), 1 deletion(-)
[commons-imaging] 01/05: IMAGING-219: add changes.xml entry
Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 470217ebc26bc5cac5b121f30121b0a144893d83
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Tue Jan 8 20:04:47 2019 +1300
IMAGING-219: add changes.xml entry
---
src/changes/changes.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 120b2f4..d5088f5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,9 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.0" date="TBA" description="First major release">
+ <action issue="IMAGING-219" dev="kinow" type="fix">
+ Imaging gets stuck parsing a RGBE input file
+ </action>
<action issue="IMAGING-154" dev="kinow" type="update">
Remove Debug class
</action>
[commons-imaging] 05/05: Merge branch 'IMAGING-220'
Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 0291af48b5c08ffd2d290cd528edd6687124b2c9
Merge: 9519e44 289ca5b
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Tue Jan 8 20:07:30 2019 +1300
Merge branch 'IMAGING-220'
src/changes/changes.xml | 3 ++
.../imaging/formats/jpeg/decoder/JpegDecoder.java | 2 +-
.../formats/jpeg/decoder/JpegDecoderTest.java | 47 +++++++++++++++++++++
...imeout-48eb4251935b4ca8b26d1859ea525c1b42ae0c78 | Bin 0 -> 932 bytes
4 files changed, 51 insertions(+), 1 deletion(-)
[commons-imaging] 04/05: IMAGING-220: add changes.xml entry
Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 289ca5bb4cd6e75a51cffce9800c34f1441da0b9
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Tue Jan 8 20:07:21 2019 +1300
IMAGING-220: add changes.xml entry
---
src/changes/changes.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d5088f5..d98a0f8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,9 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.0" date="TBA" description="First major release">
+ <action issue="IMAGING-220" dev="kinow" type="fix">
+ JpegDecoder takes a long time (+10s) to decode a bad JPEG
+ </action>
<action issue="IMAGING-219" dev="kinow" type="fix">
Imaging gets stuck parsing a RGBE input file
</action>