You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2021/03/24 14:30:32 UTC
[nifi] branch main updated: NIFI-8360: Fixed an overflow issue
where we used an integer to store the number of bytes encountered when
reading data and searching for a given pattern
This is an automated email from the ASF dual-hosted git repository.
pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 91313a2 NIFI-8360: Fixed an overflow issue where we used an integer to store the number of bytes encountered when reading data and searching for a given pattern
91313a2 is described below
commit 91313a2e75b264601984c9c3ead68f9b75e3e478
Author: Mark Payne <ma...@hotmail.com>
AuthorDate: Tue Mar 23 18:02:22 2021 -0400
NIFI-8360: Fixed an overflow issue where we used an integer to store the number of bytes encountered when reading data and searching for a given pattern
Signed-off-by: Pierre Villard <pi...@gmail.com>
This closes #4929.
---
.../src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java
index 0c6c575..ee962b8 100644
--- a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java
+++ b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/NaiveSearchRingBuffer.java
@@ -50,7 +50,7 @@ public class NaiveSearchRingBuffer {
private final byte[] lookingFor;
private final int[] buffer;
private int insertionPointer = 0;
- private int bufferSize = 0;
+ private long bufferSize = 0;
public NaiveSearchRingBuffer(final byte[] lookingFor) {
this.lookingFor = lookingFor;
@@ -63,7 +63,7 @@ public class NaiveSearchRingBuffer {
* sequence for which we are looking
*/
public byte[] getBufferContents() {
- final int contentLength = Math.min(lookingFor.length, bufferSize);
+ final int contentLength = (int) Math.min(lookingFor.length, bufferSize);
final byte[] contents = new byte[contentLength];
for (int i = 0; i < contentLength; i++) {
final byte nextByte = (byte) buffer[(insertionPointer + i) % lookingFor.length];