Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[widevine] Fix bad data pointer on clrb_out variable #1464

Merged
merged 1 commit into from
Feb 3, 2024

Conversation

CastagnaIT
Copy link
Collaborator

@CastagnaIT CastagnaIT commented Jan 31, 2024

Description

Premise, i havent understood the data target format of dataOut
this prevents me from understanding how the data should be composed/constructed in to dataOut

from my investigations i found that:
dataOut.UseData() was used to get and store current data pointer but after that, many times is used "AppendData",
this method before append data check if the internal buffer of AP4_DataBuffer is enough to store data if not re-create the internal buffer, and so the data pointer before stored (to clrb_out) will point to a bad memory address causing the segmentation fault crash

NOTE: the crash affect most of times aarch64/ARM64 cpu's, other systems looks like problem remains hidden maybe due to system optimization the "old" memory address still working

Motivation and context

fix #1394
fix #1452

How has this been tested?

Tested am@zon VOD videos episodes on:
CoreElec with aarch64 cpu
Android nvidia shield pro
Windows

Screenshots (if appropriate):

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • I have read the Contributing document
  • My code follows the Code Guidelines of this project
  • My change requires a change to the Wiki documentation
  • I have updated the documentation accordingly

@CastagnaIT CastagnaIT changed the title [widevine] Fix clrb data on dataOut [widevine] Fix bad data pointer on clrb_out variable Feb 1, 2024
@CastagnaIT CastagnaIT added Type: Fix non-breaking change which fixes an issue DRM: Widevine v21 Omega Backport: Needed labels Feb 1, 2024
@CastagnaIT CastagnaIT force-pushed the crash_test branch 4 times, most recently from ae14174 to aeadc90 Compare February 1, 2024 19:01
dataOut.UseData() was used to get and store current data pointer
but after that, many times is used "AppendData",
this method before append data check if the internal buffer of AP4_DataBuffer is enough to store data
if not re-create the internal buffer, and so the data pointer before stored will point to
a bad memory address causing Segmentation fault crash
Copy link
Contributor

@glennguy glennguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like this would have been a PITA to chase down, great work

@CastagnaIT
Copy link
Collaborator Author

quite... in the future more likely would better add code comments to explain data construction that at least for me is not so immediately clear

@CastagnaIT CastagnaIT merged commit 8bbc613 into xbmc:Omega Feb 3, 2024
10 checks passed
@CastagnaIT CastagnaIT deleted the crash_test branch February 3, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport: Done DRM: Widevine Type: Fix non-breaking change which fixes an issue v21 Omega
Projects
None yet
2 participants