Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ab18858 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Detect integer overflow

See Change-Id: Iec36fc0ea67095e18a2c238b148dad5545c102c1

Change-Id: I421f0d84c64310fcb6c5451993cfaf38125c4bb2
parent 8057f24d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -587,6 +587,7 @@ public class AudioRecord
        }

        if ( (audioData == null) || (offsetInBytes < 0 ) || (sizeInBytes < 0)
                || (offsetInBytes + sizeInBytes < 0)  // detect integer overflow
                || (offsetInBytes + sizeInBytes > audioData.length)) {
            return ERROR_BAD_VALUE;
        }
@@ -611,6 +612,7 @@ public class AudioRecord
        }

        if ( (audioData == null) || (offsetInShorts < 0 ) || (sizeInShorts < 0)
                || (offsetInShorts + sizeInShorts < 0)  // detect integer overflow
                || (offsetInShorts + sizeInShorts > audioData.length)) {
            return ERROR_BAD_VALUE;
        }