Skip to content

Commit f07fdf7

Browse files
committed
add AIOOBE when trying to remove() outside the array
1 parent f53d235 commit f07fdf7

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

core/src/processing/data/FloatList.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ public void set(int index, float what) {
133133
* @brief Remove an element from the specified index
134134
*/
135135
public float remove(int index) {
136+
if (index < 0 || index >= count) {
137+
throw new ArrayIndexOutOfBoundsException(index);
138+
}
136139
float entry = data[index];
137140
// int[] outgoing = new int[count - 1];
138141
// System.arraycopy(data, 0, outgoing, 0, index);

core/src/processing/data/IntList.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ public void set(int index, int what) {
138138
* @brief Remove an element from the specified index
139139
*/
140140
public int remove(int index) {
141+
if (index < 0 || index >= count) {
142+
throw new ArrayIndexOutOfBoundsException(index);
143+
}
141144
int entry = data[index];
142145
// int[] outgoing = new int[count - 1];
143146
// System.arraycopy(data, 0, outgoing, 0, index);

core/src/processing/data/StringList.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ public void set(int index, String what) {
134134
* @brief Remove an element from the specified index
135135
*/
136136
public String remove(int index) {
137+
if (index < 0 || index >= count) {
138+
throw new ArrayIndexOutOfBoundsException(index);
139+
}
137140
String entry = data[index];
138141
// int[] outgoing = new int[count - 1];
139142
// System.arraycopy(data, 0, outgoing, 0, index);

core/todo.txt

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ A Multiple screen crash with OpenGL
5252
A https://github.com/processing/processing/issues/1515
5353

5454

55-
_ data decision stuff
56-
_ key/valueIterator to get a version that can be removed in a loop
57-
_ in Table, added an Iterator function
58-
_ should keys() returns cropped internal array after all?
59-
_ right now it's making a copy (which is safer, so folks don't modify)
60-
_ but this means that we don't have a fast method for access
61-
_ methods for max, min, index of max/min entries? valueIndex?
62-
63-
6455
high
6556
_ draw() called again before finishing on OS X (retina issue)
6657
_ https://github.com/processing/processing/issues/1709
@@ -69,6 +60,7 @@ _ https://github.com/processing/processing/issues/1699
6960
_ Linux sometimes not responding correctly w/ the size() command
7061
_ https://github.com/processing/processing/issues/1672
7162

63+
table
7264
_ function that will convert awful CSV to TSV.. or something else?
7365
_ maybe to write binary instead? then read the binary file once it's ok?
7466
_ if loading from a File object
@@ -134,10 +126,12 @@ _ otherwise remove() would be the only one that dealt with indices
134126
_ Dict will use remove(key), so using remove(index) as default
135127
_ and removeValue(value) is probably used less
136128
_ introduce remap() instead of map() (if not deprecate?)
137-
138-
andres
139-
_ shader syntax (Andres request)
140-
_ might also need a define inside the shader to control what type it is
129+
_ key/valueIterator to get a version that can be removed in a loop
130+
_ in Table, added an Iterator function
131+
_ should keys() returns cropped internal array after all?
132+
_ right now it's making a copy (which is safer, so folks don't modify)
133+
_ but this means that we don't have a fast method for access
134+
_ methods for max, min, index of max/min entries? valueIndex?
141135

142136
shape
143137
_ PShape should be cached as well

0 commit comments

Comments
 (0)