Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Commit 6530920

Browse files
authored
Limit max file size to 1 GiB
To prevent OOM due to wasm (not 64) having a hard 4gb memory limit. Better safe than corrupt.
1 parent b15b5cf commit 6530920

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@
120120
};
121121
document.getElementById("fin").onchange = function(){
122122
if(this.files.length>0){
123+
if (this.files[0].size > 1073741824) { // 1 GiB
124+
document.getElementById("status").innerHTML = "File too large! Only files up to 1 GiB are supported.";
125+
document.getElementById("status").style.color = "#db2828";
126+
setTimeout(() => {
127+
window.location.reload();
128+
}, 3000);
129+
}
123130
document.querySelector("body > div > div > p").innerHTML = this.files[0].name;
124131
if(this.files[0].name.endsWith(".pcv")){
125132
document.getElementById("start").value = "Decrypt";
@@ -212,4 +219,4 @@
212219
WebAssembly.instantiateStreaming(fetch("/main.wasm"), go.importObject).then(result => go.run(result.instance));
213220
</script>
214221
</body>
215-
</html>
222+
</html>

0 commit comments

Comments
 (0)