Skip to content

Commit

Permalink
qedit: Do not force the sample to be freed in SampleGrabber_callback().
Browse files Browse the repository at this point in the history
Remove a work around that causes a crash in Unravel Two.

There is a callback in Unravel Two that appears to add a reference to a
IMediaSample, which this workaround treats as a leak and releases. However, the
application also later releases the reference itself, causing a use-after-free.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51616
Signed-off-by: Brendan McGrath <brendan@redmandi.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
  • Loading branch information
redmcg authored and julliard committed Jul 18, 2022
1 parent 2f280d0 commit 1113f42
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions dlls/qedit/samplegrabber.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ static void SampleGrabber_callback(struct sample_grabber *This, IMediaSample *sa
if (ref)
{
ERR("(%p) Callback referenced sample %p by %lu\n", This, sample, ref);
/* ugly as hell but some apps are sooo buggy */
while (ref--)
IMediaSample_Release(sample);
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion dlls/qedit/tests/mediadet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ static void test_samplegrabber(void)
ok(samplecb_called == TRUE, "SampleCB should have been called\n");

refcount = IUnknown_Release(&my_sample.sample);
todo_wine ok(!refcount, "Got unexpected refcount %ld.\n", refcount);
ok(!refcount, "Got unexpected refcount %ld.\n", refcount);

IMemInputPin_Release(inpin);
IPin_Release(pin);
Expand Down

0 comments on commit 1113f42

Please sign in to comment.