@@ -49,7 +49,7 @@ public class ByteArrayModificationFactory {
49
49
public static final String FILE_NAME = "de/rub/nds/modifiablevariable/explicit/array.vec" ;
50
50
51
51
/**
52
- *
52
+ *
53
53
* @param xor
54
54
* bytes to xor
55
55
* @param startPosition
@@ -72,7 +72,7 @@ public static VariableModification<byte[]> payload(final byte[] payload) {
72
72
73
73
/**
74
74
* *
75
- *
75
+ *
76
76
* @param bytesToInsert
77
77
* bytes to xor
78
78
* @param startPosition
@@ -85,7 +85,7 @@ public static VariableModification<byte[]> insert(final byte[] bytesToInsert, fi
85
85
86
86
/**
87
87
* * Deletes $count bytes from the input array beginning at $startPosition
88
- *
88
+ *
89
89
* @param startPosition
90
90
* negative numbers mean that the position is taken from the end
91
91
* @param count
@@ -98,7 +98,7 @@ public static VariableModification<byte[]> delete(final int startPosition, final
98
98
99
99
/**
100
100
* Duplicates the byte array
101
- *
101
+ *
102
102
* @return duplicate variable modification
103
103
*/
104
104
public static VariableModification <byte []> duplicate () {
@@ -117,7 +117,7 @@ public static VariableModification<byte[]> explicitValueFromFile(int value) {
117
117
118
118
/**
119
119
* Shuffles the bytes in the array, given a specified array of positions.
120
- *
120
+ *
121
121
* @param shuffle
122
122
* positions that define shuffling
123
123
* @return shuffling variable modification
@@ -162,13 +162,19 @@ public static VariableModification<byte[]> createRandomModification(byte[] origi
162
162
switch (r ) {
163
163
case BYTE_ARRAY_XOR_MODIFICATION :
164
164
int modificationArrayLength = random .nextInt (modifiedArrayLength );
165
+ if (modificationArrayLength == 0 ) {
166
+ modificationArrayLength ++;
167
+ }
165
168
byte [] xor = new byte [modificationArrayLength ];
166
169
random .nextBytes (xor );
167
170
int startPosition = random .nextInt (modifiedArrayLength - modificationArrayLength );
168
171
vm = new ByteArrayXorModification (xor , startPosition );
169
172
return vm ;
170
173
case BYTE_ARRAY_INSERT_MODIFICATION :
171
174
modificationArrayLength = random .nextInt (MAX_CONFIG_PARAMETER );
175
+ if (modificationArrayLength == 0 ) {
176
+ modificationArrayLength ++;
177
+ }
172
178
byte [] bytesToInsert = new byte [modificationArrayLength ];
173
179
random .nextBytes (bytesToInsert );
174
180
int insertPosition = random .nextInt (modifiedArrayLength );
@@ -182,6 +188,9 @@ public static VariableModification<byte[]> createRandomModification(byte[] origi
182
188
return vm ;
183
189
case BYTE_ARRAY_EXPLICIT_VALUE_MODIFICATION :
184
190
modificationArrayLength = random .nextInt (MAX_CONFIG_PARAMETER );
191
+ if (modificationArrayLength == 0 ) {
192
+ modificationArrayLength ++;
193
+ }
185
194
byte [] explicitValue = new byte [modificationArrayLength ];
186
195
random .nextBytes (explicitValue );
187
196
vm = new ByteArrayExplicitValueModification (explicitValue );
0 commit comments