Fix various minor issues found by LGTM
- Unnecessary boxing - Integer overflow - Path traversal via zip - Dangerous synchronization pattern
This commit is contained in:
+1
-1
@@ -84,7 +84,7 @@ public class PodcastReceiverAdminController {
|
||||
}
|
||||
|
||||
private void download(int[] episodeIds) {
|
||||
for (Integer episodeId : episodeIds) {
|
||||
for (int episodeId : episodeIds) {
|
||||
PodcastEpisode episode = podcastService.getEpisode(episodeId, false);
|
||||
if (episode != null && episode.getUrl() != null &&
|
||||
(episode.getStatus() == PodcastStatus.NEW ||
|
||||
|
||||
@@ -311,7 +311,7 @@ public class StreamController {
|
||||
return file.getFileSize();
|
||||
}
|
||||
|
||||
return duration * maxBitRate * 1000L / 8L;
|
||||
return duration * (long)maxBitRate * 1000L / 8L;
|
||||
}
|
||||
|
||||
private HttpRange getRange(HttpServletRequest request, MediaFile file) {
|
||||
|
||||
@@ -173,6 +173,9 @@ public class UploadController {
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
File entryFile = new File(file.getParentFile(), entry.getName());
|
||||
if (!entryFile.toPath().normalize().startsWith(file.getParentFile().toPath())) {
|
||||
throw new Exception("Bad zip filename: " + StringUtil.toHtml(entryFile.getPath()));
|
||||
}
|
||||
|
||||
if (!entry.isDirectory()) {
|
||||
|
||||
@@ -263,4 +266,4 @@ public class UploadController {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class MetricsManager {
|
||||
// Main metrics registry
|
||||
private static final MetricRegistry metrics = new MetricRegistry();
|
||||
|
||||
private static Boolean metricsActivatedByConfiguration = null;
|
||||
private static volatile Boolean metricsActivatedByConfiguration = null;
|
||||
private static Object _lock = new Object();
|
||||
|
||||
// Potential metrics reporters
|
||||
|
||||
Reference in New Issue
Block a user