Skip to content

Commit

Permalink
Regression(274445@main): Crash under HTMLMediaElement::updateActiveTe…
Browse files Browse the repository at this point in the history
…xtTrackCues() on Hulu.com

https://bugs.webkit.org/show_bug.cgi?id=269394
rdar://122959342

Reviewed by Jer Noble.

In 274445@main, I updated CueInterval to be an alias to:
```
PODInterval<MediaTime, WeakPtr<TextTrackCue, WeakPtrImplWithEventTargetData>>
```
instead of:
```
PODInterval<MediaTime, TextTrackCue*>
```
per our recent smart pointer guidelines.

When doing do, I noticed that PODInterval has different implementations when the
second type is a WeakPtr. Adopting WeakPtr led to build errors because the
PODInterval's specialization for WeakPtr was missing operator==(). To fix the
build, I copied the generic PODInterval's operator==() and used it. However, I
failed to noticed that the 2 specializations had different operator<()
implementations as well. In particular, the generic operator<() was checking
userData while the WeakPtr specialization one wasn't. This mismatch between
operator==() (which was checking userData) and operator<() (which wasn't checking
userData) was the cause of these crashes.

I now updated operator<() to be the same of both specializations (except for
calling `.get()` to extract the raw pointer from the WeakPtr) and this addressed
the crashes on hulu.com.

* Source/WebCore/platform/PODInterval.h:

Canonical link: https://commits.webkit.org/274670@main
  • Loading branch information
cdumez committed Feb 15, 2024
1 parent 7900c68 commit fd9c136
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/WebCore/platform/PODInterval.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ template<typename T, typename U, typename WeakPtrImpl> class PODInterval<T, Weak
return true;
if (other.Base::low() < Base::low())
return false;
return Base::high() < other.Base::high();
if (Base::high() < other.Base::high())
return true;
if (other.Base::high() < Base::high())
return false;
return Base::data().get() < other.Base::data().get();
}

bool operator==(const PODInterval& other) const
Expand Down

0 comments on commit fd9c136

Please sign in to comment.