Closed aipsvrr closed 3 months ago
Hi @JeromeMartinez , I need some time to get an asset (will try update later on if you would still want to have that). But for now, I'd like to add some details :) Here is a crash stack: `Program terminated with signal 11, Segmentation fault.
from /lib64/libmediainfo.so.0
from /lib64/libmediainfo.so.0
The reason of that SEGFAULT is that Common
is NULL.
That happened because Common
was not initialized in File_ChannelSplitting::Read_Buffer_Init()
method due to wrong BitDepth
that was calculated as 1
(BitDepth=3*8/16
) because of improper BlockAlign
value (BlockAlign=3 instead of 48) in WaveAudioEssenceDescriptor while ChannelsCount
is 16 and QuantizationBits
are 24.
Well, I'm pretty sure that BlockAlign value was wrong in my test asset (I see that similar problems were already observed and Descriptor was fixed before for PCM parser).
But mediainfo crash even on "non-well formed" file is not something that we expect :(
Descriptor's (BlockAlign) Fix was not working in my case because BlockAlign was fixed after Parser->BitDepth was already calculated to 1
for ChannelSplitting parser. Btw, I tried to apply this fix earlier in code and it works then.
By summarizing all above, two things were spotted:
1) Mediainfo can mitigate influence of potentially incorrect BlockAlign descriptor for its analysis but it depends on descriptor's sequence (if ChooseParser_Pcm
would be called before ChooseParser_ChannelSplitting
then no problems would be observed)
2) ChannelSplitting Parser can stay uninitialized if audio is not supported but still can be called and so segfault is possible in this case (no check on null pointer is performing in Read_Buffer_Continue()
)
Hope you will find my description useful. Thanks!
But mediainfo crash even on "non-well formed" file is not something that we expect :(
We agree :)
Btw, I tried to apply this fix earlier in code and it works then.
I definitely need to refactor this code and avoid to rely much on BlockAlign
, because the current code will not catch Dolby E in a file with wrong BlockAlign
.
In the meantime, I take this "hot fix", thank you.
Could you share a file demonstrating this issue?