<div dir="ltr">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:<br><br>@@ -4075,6 +4074,7 @@ void CostEstimateGroup::processTasks(int workerThreadID)<br><br> 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))<br> {<br>+ MotionEstimatorTLD& m_metld = m_lookahead.m_metld[id];<br><br>Would someone be able to commit it for me?<br><br><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Jun 23, 2025 at 3:37 PM Pranav Kant <<a href="mailto:prka@google.com">prka@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>We noticed that one of our internal tests fails when trying to access uninitialized memory.<br><br></div><div>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.<div><br></div><div>It seems just moving the declaration closer to the use in that function should be sufficient?</div><div><br></div><div>Thanks.</div><div><br></div><div><br></div></div></div>
</blockquote></div>