question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: corrupted input

See original GitHub issue

I have transferred xz file into JS using XMLHttpRequest. The content type of response is application/x-xz, and I checked response content which seems complete. Then I use LZMA.decomporess(request.response, ...) and got corrupted input error. What is wrong in my case? Thanks in advance.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

1reaction
mauron85commented, Aug 18, 2021

@xseman For my needs, I switched to https://github.com/cscott/lzma-purejs. It generates proper raw lzma. Only it adds some padding (additional information) to the end of file, but I just trimmed that and can extract with comnand line xz.

Also forked lzma-purejs, but basically I made it es6 module and reorganised some components, so it can be tree shaken.| https://github.com/mauron85/lzma-purejs

1reaction
mauron85commented, May 2, 2021

Same problem. Testing with xz raw:

# compress into raw format
echo "hello" | xz -c --lzma1=lc=3,lp=0,pb=2 --format=raw > qr.xz

# test decode with xz - prints hello
cat qr.xz | xz -d --lzma1=lc=3,lp=0,pb=2 --format=raw

Try to decode with LZMA-JS

const fs = require("fs");
const LZMA = require("lzma");

const path = 'qr.xz';
const file = fs.readFileSync(path);
const byteArray = new Uint8Array(file);
const decomp = LZMA.decompress(byteArray);
console.log(decomp);

Fails with exception:

➜  RAMDisk node decomp.js
/Volumes/RAMDisk/node_modules/lzma/src/lzma_worker.js:313
            throw new Error("corrupted input");
            ^

Error: corrupted input
    at $init_0 (/Volumes/RAMDisk/node_modules/lzma/src/lzma_worker.js:313:19)
    at $LZMAByteArrayDecompressor (/Volumes/RAMDisk/node_modules/lzma/src/lzma_worker.js:344:9)
    at Object.decompress (/Volumes/RAMDisk/node_modules/lzma/src/lzma_worker.js:2554:29)
    at Object.<anonymous> (/Volumes/RAMDisk/decomp.js:7:21)

Same problem occurs, when I try to decompress file created with LZMA-JS with xz:

cat qr.xz | xz -d --lzma1=lc=3,lp=0,pb=2 --format=raw

xz: (stdin): Compressed data is corrupt
Read more comments on GitHub >

github_iconTop Results From Across the Web

Lzma library error: Corrupted input data · Issue #268 - GitHub
Version: 1.6.2 (Ubuntu SNAP) I received this error while trying to write the Ubuntu Server 64bit image from the Choose OS menu to...
Read more >
199350 – Lzma library error: Corrupted input data
After recent import of LZMA I'm getting: Lzma library error: Corrupted input data when running "tar xvjf filename.txz" On ARM: Tested on ...
Read more >
Large file transfer gives error: Corrupted MAC on input
When you transfer a large file by HTTP it will disconnect and give you this error: Disconnecting: Corrupted MAC on input. This can...
Read more >
Corrupted File in Dynamic Input - Designer - Alteryx Community
Solved: Good morning, I am having issues pulling in an .xlsx file into my workflow. Every time I run my flow it errors...
Read more >
Python LZMA Corrupt data error when trying to decompress
The error I am getting is: _lzma.LZMAError: Corrupt input data. I don't think the data is corrupt because I can download it from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found