jsign: Signing large MSI files fails
Hi, I tried to use Jsign to sign a large MSI file (311MB), it fails with the following Exception:
[ec2-user@ip-172-31-35-244 original_jsign]$ jsign -s key.jks --storepass 123456 -storetype jks -a EKM ~/ekm-2.0_large.msi Adding Authenticode signature to /home/ec2-user/ekm-2.0_large.msi jsign: Couldn't sign /home/ec2-user/ekm-2.0_large.msi java.lang.RuntimeException: java.io.IOException: Map failed at net.jsign.poi.poifs.filesystem.POIFSStream$StreamBlockByteBufferIterator.next(POIFSStream.java:170) at net.jsign.poi.poifs.filesystem.POIFSStream$StreamBlockByteBufferIterator.next(POIFSStream.java:142) at net.jsign.msi.MSIFile.computeDigest(MSIFile.java:180) at net.jsign.msi.MSIFile.createIndirectData(MSIFile.java:199) at net.jsign.AuthenticodeSigner.createSignedData(AuthenticodeSigner.java:368) at net.jsign.AuthenticodeSigner.sign(AuthenticodeSigner.java:339) at net.jsign.SignerHelper.sign(SignerHelper.java:424) at net.jsign.JsignCLI.execute(JsignCLI.java:111) at net.jsign.JsignCLI.main(JsignCLI.java:40) Caused by: java.io.IOException: Map failed at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:938) at net.jsign.poi.poifs.nio.FileBackedDataSource.read(FileBackedDataSource.java:95) at net.jsign.poi.poifs.filesystem.POIFSFileSystem.getBlockAt(POIFSFileSystem.java:427) at net.jsign.poi.poifs.filesystem.POIFSStream$StreamBlockByteBufferIterator.next(POIFSStream.java:166) ... 8 more Caused by: java.lang.OutOfMemoryError: Map failed at sun.nio.ch.FileChannelImpl.map0(Native Method) at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:935) ... 11 more
Signing a small file of 4MB completes successfully. Is there any size limitation of MSI files that can be signed? If so, what is it? Thanks in advance
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (10 by maintainers)
Commits related to this issue
- Removed the maximum heap size in the command line script (#82) — committed to ebourg/jsign by ebourg 3 years ago
- Workaround for "OutOfMemoryError: Map failed" error when signing large MSI files (issue #82) — committed to yaegor/jsign by yaegor 3 years ago
- Fix for "OutOfMemoryError: Map failed" error when signing large MSI files by separating read and write operations (issue #82) — committed to yaegor/jsign by yaegor 3 years ago
- Fixed the 'Map failed' OutOfMemoryError when signing large MSI files (Fixes #74 and #82) — committed to ebourg/jsign by ebourg 3 years ago
Indeed the channel doesn’t work, my test case was incomplete. Thank you for checking. Let’s use two POIFSFileSystems then.