mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Fixed runtime errors in large obfuscated code when both rc4 and base64 encodings are enabled
This commit is contained in:
@@ -18,7 +18,7 @@ import { StringArrayEncoding } from '../../enums/node-transformers/string-array-
|
||||
import { MapStorage } from '../MapStorage';
|
||||
|
||||
@injectable()
|
||||
export class StringArrayStorage extends MapStorage <string, IStringArrayStorageItemData> implements IStringArrayStorage {
|
||||
export class StringArrayStorage extends MapStorage <`${string}-${TStringArrayEncoding}`, IStringArrayStorageItemData> implements IStringArrayStorage {
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
@@ -227,9 +227,9 @@ export class StringArrayStorage extends MapStorage <string, IStringArrayStorageI
|
||||
this.storage = new Map(
|
||||
this.arrayUtils
|
||||
.shuffle(Array.from(this.storage.entries()))
|
||||
.map<[string, IStringArrayStorageItemData]>(
|
||||
.map<[`${string}-${TStringArrayEncoding}`, IStringArrayStorageItemData]>(
|
||||
(
|
||||
[value, stringArrayStorageItemData]: [string, IStringArrayStorageItemData],
|
||||
[value, stringArrayStorageItemData],
|
||||
index: number
|
||||
) => {
|
||||
stringArrayStorageItemData.index = index;
|
||||
@@ -250,7 +250,9 @@ export class StringArrayStorage extends MapStorage <string, IStringArrayStorageI
|
||||
*/
|
||||
private getOrSetIfDoesNotExist (value: string): IStringArrayStorageItemData {
|
||||
const { encodedValue, encoding, decodeKey }: IEncodedValue = this.getEncodedValue(value);
|
||||
const storedStringArrayStorageItemData: IStringArrayStorageItemData | undefined = this.storage.get(encodedValue);
|
||||
|
||||
const cacheKey = <`${string}-${TStringArrayEncoding}`>`${encodedValue}-${encoding}`;
|
||||
const storedStringArrayStorageItemData: IStringArrayStorageItemData | undefined = this.storage.get(cacheKey);
|
||||
|
||||
if (storedStringArrayStorageItemData) {
|
||||
return storedStringArrayStorageItemData;
|
||||
@@ -264,7 +266,7 @@ export class StringArrayStorage extends MapStorage <string, IStringArrayStorageI
|
||||
index: this.getLength()
|
||||
};
|
||||
|
||||
this.storage.set(encodedValue, stringArrayStorageItemData);
|
||||
this.storage.set(cacheKey, stringArrayStorageItemData);
|
||||
|
||||
return stringArrayStorageItemData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user