-
Notifications
You must be signed in to change notification settings - Fork 116
Panic when decrypt segment #492
Copy link
Copy link
Open
Description
Hi,
I have some segments that cause panic in mp4.CryptSampleCenc when decrypting
mp4ff-decrypt -init init.m4i -key "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" panic.m4v out.m4vpanic: runtime error: slice bounds out of range [:712805485] with capacity 57344
goroutine 1 [running]:
github.com/Eyevinn/mp4ff/mp4.CryptSampleCenc({0xc0001c2000, 0x9ec0, 0xe000}, {0xc000010330?, 0xe2cd6d0?, 0xc0001cf1c2?}, {0xc000010550, 0x10, 0x10}, {0xc000040180, ...})
/tmp/mp4ff/mp4/crypto.go:170 +0x19b
github.com/Eyevinn/mp4ff/mp4.decryptSamplesInPlace({0xc0000104e0, 0x4}, {0xc0001e4288, 0xc, 0x500c00006c301?}, {0xc000010330, 0x10, 0x10}, 0xc000078480, 0xc0000121c0)
/tmp/mp4ff/mp4/crypto.go:737 +0x1c5
github.com/Eyevinn/mp4ff/mp4.DecryptFragment(0xc0000b83c0, {{0xc00006c390, 0x2, 0x2}, {0xc0000cef30, 0x1, 0x1}}, {0xc000010330, 0x10, 0x10})
/tmp/mp4ff/mp4/crypto.go:685 +0x2a6
github.com/Eyevinn/mp4ff/mp4.DecryptSegment(0xc0000fc000, {{0xc00006c390, 0x2, 0x2}, {0xc0000cef30, 0x1, 0x1}}, {0xc000010330, 0x10, 0x10})
/tmp/mp4ff/mp4/crypto.go:638 +0x13b
main.decryptFile({0x5942c8?, 0xc00009a050?}, {0x5942c8, 0xc00009a060}, {0x5942e8, 0xc00009a058}, {0xc000010330, 0x10, 0x10})
/tmp/mp4ff/cmd/mp4ff-decrypt/main.go:148 +0x29f
main.run({0xc000012070, 0x7, 0x7})
/tmp/mp4ff/cmd/mp4ff-decrypt/main.go:105 +0x48b
main.main()
/tmp/mp4ff/cmd/mp4ff-decrypt/main.go:46 +0x28
ok.m4v.zip - previous segment of same stream that can be decrypted
panic.m4v.zip - segment that causes panic
Perhaps there is also a problem with parsing senc box. mp4ff-info displays strange values for senc
mp4ff-info -l all:1 panic.m4v
...
[senc] size=640 version=0 flags=000002
- sampleCount: 12
- perSampleIVSize: 0
- sample[1]:
- subSample[1]: nrBytesClear=16656 nrBytesProtected=712788829
- subSample[2]: nrBytesClear=7 nrBytesProtected=393216
- subSample[3]: nrBytesClear=0 nrBytesProtected=5111808
- subSample[4]: nrBytesClear=0 nrBytesProtected=6488064
- subSample[5]: nrBytesClear=4400 nrBytesProtected=7274496
- subSample[6]: nrBytesClear=4736 nrBytesProtected=6684672
- subSample[7]: nrBytesClear=4400 nrBytesProtected=7274496
- subSample[8]: nrBytesClear=4736 nrBytesProtected=6619136
- subSample[9]: nrBytesClear=21760 nrBytesProtected=2965776
...
However, in another mp4 parser, this values are correct:
Box type : senc
Box version : 0
Box flags : 0x2
sample count : 12
Entries : size = 12
- [0]
iv : 002d41102a7c4b5d
Entries : size = 7
- [0] : clear_data=6, encrypted_data=0
- [1] : clear_data=78, encrypted_data=0
- [2] : clear_data=99, encrypted_data=4400
- [3] : clear_data=111, encrypted_data=4736
- [4] : clear_data=102, encrypted_data=4400
- [5] : clear_data=111, encrypted_data=4736
- [6] : clear_data=101, encrypted_data=21760
...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels