Explorar el Código

fix comparison test

Gildas hace 5 años
padre
commit
0f2fd26c47
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      lib/single-file/single-file-util.js

+ 3 - 3
lib/single-file/single-file-util.js

@@ -348,12 +348,12 @@ this.singlefile.lib.util = this.singlefile.lib.util || (() => {
 		}
 
 		function compareBytes(mask, pattern) {
-			let patternMatch = true;
+			let patternMatch = true, index = 0;
 			const value = new Uint8Array(buffer, 0, mask.length);
-			for (let index = 0; index < mask.length && patternMatch; index++) {
+			for (index = 0; index < mask.length && patternMatch; index++) {
 				patternMatch = patternMatch && ((value[index] & mask[index]) == pattern[index]);
 			}
-			return patternMatch;
+			return patternMatch && (index == mask.length);
 		}
 	}