jet2jet / resedit-js-cli

Node.js command line tool for editing Windows Resource data
MIT License
7 stars 0 forks source link

"Invalid typed array length" #32

Open rejetto opened 1 month ago

rejetto commented 1 month ago

hey! i'm trying to npx resedit-cli --in hfs.exe --icon hfs.ico --out hfs2.exe Archive.zip

but i get this error

resedit: RangeError: Invalid typed array length: 131072
    at new Uint8Array (<anonymous>)
    at copyBuffer (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit/dist/util/functions.js:36:11)
    at allocatePartialBinary (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit/dist/util/functions.js:42:5)
    at new IconItem (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit/dist/data/IconItem.js:60:24)
    at IconItem.from (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit/dist/data/IconItem.js:112:16)
    at new IconFile (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit/dist/data/IconFile.js:115:37)
    at IconFile.from (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit/dist/data/IconFile.js:134:16)
    at emitIcons (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit-cli/dist/emit/icons.js:43:44)
    at async emitResources (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit-cli/dist/run.js:279:17)
    at async run (file:///Users/rejetto/.npm/_npx/af7be33d5185a36e/node_modules/resedit-cli/dist/run.js:329:22)

it's an exe generated with pkg for node.js, and i'm running this under macos on arm64

jet2jet commented 1 month ago

Thanks for the report.
It seems that the bitmap data in icon file has weird image size (biSizeImage), causing unexpected behavior in resedit-js.

I'll work to solve this problem, making the new version of resedit-js/resedit-js-cli.

jet2jet commented 1 month ago

I published resedit-cli@2.0.1 to solve the issue.
Please use this version.
# Note that overwriting the icon instead of append, use --icon <icon-id>,hfs.ico (which <icon-id> may be 1 for Node.js).

rejetto commented 1 month ago

thanks! i'm already using the "1," but decided to remove it to simplify the test case. in the meantime i workaround-ed the problem by using another file icon file. you can close this issue, i guess