diff --git a/iped-engine/src/main/java/iped/engine/task/transcript/VoskTranscriptTask.java b/iped-engine/src/main/java/iped/engine/task/transcript/VoskTranscriptTask.java index bcddd49062..f2aab01193 100644 --- a/iped-engine/src/main/java/iped/engine/task/transcript/VoskTranscriptTask.java +++ b/iped-engine/src/main/java/iped/engine/task/transcript/VoskTranscriptTask.java @@ -97,7 +97,8 @@ protected TextAndScore transcribeAudio(File tmpFile) throws Exception { int words = 0; int nbytes; - byte[] buf = new byte[1 << 20]; + // Buffer must be small (see #1909) + byte[] buf = new byte[(int) Math.min(tmpFile.length(), 1 << 16)]; while ((nbytes = ais.read(buf)) >= 0) { if (recognizer.acceptWaveForm(buf, nbytes)) { TextScoreWords result = decodeFromJson(recognizer.getResult());