Quellcode durchsuchen

fix comparison test

Gildas vor 5 Jahren
Ursprung
Commit
0f2fd26c47
1 geänderte Dateien mit 3 neuen und 3 gelöschten Zeilen
  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);
 		}
 	}