[Bug]: MJPEG decoder crashes with some JPEGs
Description:
Passing certain JPEGs to the AMF MJPEG decoder crashes the decoder, an access violation error in amdxx64.dll can easily be produced.
To Reproduce:
- Create a decoder component with AMFVideoDecoderUVD_MJPEG.
- Create an AMFBuffer from the sample jpeg file attached.
- Submit the input frame with the SubmitInput method.
Setup:
- OS: Windows 11
- Driver Version: 24.3.1 (latest)
- GPU: tested with AMD Radeon 740M
Additional context I have not checked the jpeg file for absolute correctness, but it looks fine when opening in most apps. So I would definitely not expect a driver crash of this kind. We observed these errors from time to time with our application and were able to save a sample of the JPEG data that is causing the problem for us. With this file, we can always reproduce the crash in our testing environment.
Sample JPEG file causing the crash:
I found that the provided file “test.jpg” has some metadata which causes the AMFVideoDecoderUVD_MJPEG to act up. The “comments” section of the metadata is particularly suspicious.
I have created an internal ticket to the decoder folks to address this issue with handling the metadata. Scrubbing the metadata from the file allows decoding to proceed without issue. You can use this as a workaround for now until the fix is released in a public driver update.
Thanks for looking into this. Yes, the comment is unusual to say the least. These images are coming from IP cameras out of our control. Knowing the nature of the issue, getting rid of the comment is a viable idea for us. It would be great though if the API just returned some error result in such cases or even in cases when frames are corrupted (like I see e.g. here).
Thanks.
The issue has been fixed internally and the fix will be available in a future public driver release.
We will notify when the release is made publicly available.
Verified fixed with public driver version 24.12.1. Provided JPEG is able to be decoded.