GPUOpen-LibrariesAndSDKs / AMF

The Advanced Media Framework (AMF) SDK provides developers with optimal access to AMD devices for multimedia processing
Other
582 stars 148 forks source link

[Bug]: MJPEG decoder crashes with some JPEGs #469

Open Alex18947 opened 2 months ago

Alex18947 commented 2 months ago

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:

  1. Create a decoder component with AMFVideoDecoderUVD_MJPEG.
  2. Create an AMFBuffer from the sample jpeg file attached.
  3. Submit the input frame with the SubmitInput method.

Setup:

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:

test.zip

rhutsAMD commented 2 months ago

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.

image

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.

Alex18947 commented 2 months ago

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.

rhutsAMD commented 3 days ago

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.