@@ -49,7 +49,7 @@ public class ByteArrayModificationFactory {
4949 public static final String FILE_NAME = "de/rub/nds/modifiablevariable/explicit/array.vec" ;
5050
5151 /**
52- *
52+ *
5353 * @param xor
5454 * bytes to xor
5555 * @param startPosition
@@ -72,7 +72,7 @@ public static VariableModification<byte[]> payload(final byte[] payload) {
7272
7373 /**
7474 * *
75- *
75+ *
7676 * @param bytesToInsert
7777 * bytes to xor
7878 * @param startPosition
@@ -85,7 +85,7 @@ public static VariableModification<byte[]> insert(final byte[] bytesToInsert, fi
8585
8686 /**
8787 * * Deletes $count bytes from the input array beginning at $startPosition
88- *
88+ *
8989 * @param startPosition
9090 * negative numbers mean that the position is taken from the end
9191 * @param count
@@ -98,7 +98,7 @@ public static VariableModification<byte[]> delete(final int startPosition, final
9898
9999 /**
100100 * Duplicates the byte array
101- *
101+ *
102102 * @return duplicate variable modification
103103 */
104104 public static VariableModification <byte []> duplicate () {
@@ -117,7 +117,7 @@ public static VariableModification<byte[]> explicitValueFromFile(int value) {
117117
118118 /**
119119 * Shuffles the bytes in the array, given a specified array of positions.
120- *
120+ *
121121 * @param shuffle
122122 * positions that define shuffling
123123 * @return shuffling variable modification
@@ -162,13 +162,19 @@ public static VariableModification<byte[]> createRandomModification(byte[] origi
162162 switch (r ) {
163163 case BYTE_ARRAY_XOR_MODIFICATION :
164164 int modificationArrayLength = random .nextInt (modifiedArrayLength );
165+ if (modificationArrayLength == 0 ) {
166+ modificationArrayLength ++;
167+ }
165168 byte [] xor = new byte [modificationArrayLength ];
166169 random .nextBytes (xor );
167170 int startPosition = random .nextInt (modifiedArrayLength - modificationArrayLength );
168171 vm = new ByteArrayXorModification (xor , startPosition );
169172 return vm ;
170173 case BYTE_ARRAY_INSERT_MODIFICATION :
171174 modificationArrayLength = random .nextInt (MAX_CONFIG_PARAMETER );
175+ if (modificationArrayLength == 0 ) {
176+ modificationArrayLength ++;
177+ }
172178 byte [] bytesToInsert = new byte [modificationArrayLength ];
173179 random .nextBytes (bytesToInsert );
174180 int insertPosition = random .nextInt (modifiedArrayLength );
@@ -182,6 +188,9 @@ public static VariableModification<byte[]> createRandomModification(byte[] origi
182188 return vm ;
183189 case BYTE_ARRAY_EXPLICIT_VALUE_MODIFICATION :
184190 modificationArrayLength = random .nextInt (MAX_CONFIG_PARAMETER );
191+ if (modificationArrayLength == 0 ) {
192+ modificationArrayLength ++;
193+ }
185194 byte [] explicitValue = new byte [modificationArrayLength ];
186195 random .nextBytes (explicitValue );
187196 vm = new ByteArrayExplicitValueModification (explicitValue );
0 commit comments