Gildas преди 5 години
родител
ревизия
0f2fd26c47
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  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);
 		}
 	}