Skip to content

Commit ad968e4

Browse files
committed
Changed maven compile to be more strict with lint issues, and fixed a couple of issues along the way:
* [fallthrough] possible fall-through into case * [this-escape] possible 'this' escape before subclass is fully initialized
1 parent 2ada172 commit ad968e4

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,12 @@
330330
<compilerId>javac-with-errorprone</compilerId>
331331
<forceJavacCompilerUse>true</forceJavacCompilerUse>
332332
<showWarnings>true</showWarnings>
333+
<failOnError>true</failOnError>
334+
<failOnWarning>true</failOnWarning>
333335
<compilerArgs>
336+
<!-- Surpress maven option warnings because we are
337+
focusing on code issues -->
338+
<arg>-Xlint:-options</arg>
334339
<arg>-Xlint:all</arg>
335340
</compilerArgs>
336341
</configuration>

src/main/java/net/bramp/ffmpeg/FFmpeg.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public FFmpeg(@Nonnull String path) throws IOException {
9292
this(path, new RunProcessFunction());
9393
}
9494

95+
@SuppressWarnings("this-escape")
9596
public FFmpeg(@Nonnull String path, @Nonnull ProcessFunction runFunction) throws IOException {
9697
super(path, runFunction);
9798
version();

src/main/java/net/bramp/ffmpeg/info/Codec.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public Codec(String name, String longName, String flags) {
6464
break;
6565
case 'T':
6666
this.type = CodecType.ATTACHMENT;
67+
break;
6768
default:
6869
throw new IllegalArgumentException("Invalid codec type '" + flags.charAt(2) + "'");
6970
}

src/main/java/net/bramp/ffmpeg/nut/Frame.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.bramp.ffmpeg.nut;
22

33
import com.google.common.base.MoreObjects;
4+
import java.io.EOFException;
45
import java.io.IOException;
56
import java.nio.charset.StandardCharsets;
67
import java.util.Map;
@@ -162,7 +163,12 @@ public void read(NutReader nut, NutDataInputStream in, int code) throws IOExcept
162163
long pos = in.offset();
163164
sideData = readMetaData(in);
164165
metaData = readMetaData(in);
165-
size -= (in.offset() - pos);
166+
long metadataLen = (in.offset() - pos);
167+
if (metadataLen > size) {
168+
throw new EOFException();
169+
}
170+
171+
size -= (int) metadataLen;
166172

167173
} else {
168174
sideData = null;

0 commit comments

Comments
 (0)