[x265] CostEstimateGroup::processTasks() accesses uninitialized memory

Pranav Kant prka at google.com
Wed Jun 25 18:49:51 UTC 2025


Moving that declaration to following location shouldn't have any
side-effects. We are just bringing the declaration closer to its usage to
avoid accessing uninitialized memory:

@@ -4075,6 +4074,7 @@ void CostEstimateGroup::processTasks(int
workerThreadID)

             if (m_lookahead.m_param->bEnableTemporalFilter && curFrame &&
(curFrame->m_lowres.sliceType == X265_TYPE_IDR ||
curFrame->m_lowres.sliceType == X265_TYPE_I || curFrame->m_lowres.sliceType
== X265_TYPE_P))
             {
+                MotionEstimatorTLD& m_metld = m_lookahead.m_metld[id];

Would someone be able to commit it for me?



On Mon, Jun 23, 2025 at 3:37 PM Pranav Kant <prka at google.com> wrote:

> Hi,
>
> We noticed that one of our internal tests fails when trying to access
> uninitialized memory.
>
> In source/encoder/slicetype.cpp, processTasks() accesses
> `m_lookahead.m_metld` which is only initialized in the constructor when
> `m_param->bEnableTemporalFilter` is true. This can lead to a crash when
> calling processTasks with bEnableTemporalFilter = false.
>
> It seems just moving the declaration closer to the use in that function
> should be sufficient?
>
> Thanks.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250625/b27148bc/attachment.htm>


More information about the x265-devel mailing list