<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 22, 2017 at 3:07 PM, <span dir="ltr"><<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""># HG changeset patch<br>
# User Santhoshini Sekar <<a href="mailto:santhoshini@multicorewareinc.com">santhoshini@multicorewareinc.<wbr>com</a>><br>
# Date 1513927117 -19800<br>
# Fri Dec 22 12:48:37 2017 +0530<br>
# Branch stable<br>
</span># Node ID f41671b53ae084a8207e24a91d3a7c<wbr>f2a96cd1ce<br>
<span class=""># Parent f7498acb38746d9b799d1b45343a3d<wbr>b56cdba306<br>
Fix possible NULL pointer dereferencing in cudata init<br>
<br>
diff --git a/source/common/framedata.cpp b/source/common/framedata.cpp<br>
--- a/source/common/framedata.cpp<br>
+++ b/source/common/framedata.cpp<br>
@@ -41,9 +41,12 @@<br>
if (param.rc.bStatWrite)<br>
m_spsrps = const_cast<RPS*>(sps.spsrps);<br>
<br>
- m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame, param);<br>
- for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)<br>
- m_picCTU[ctuAddr].initialize(<wbr>m_cuMemPool, 0, param, ctuAddr);<br>
+ bool isallocated = m_cuMemPool.create(0, param.internalCsp, sps.numCUsInFrame, param);<br>
+ if (isallocated)<br>
+ for (uint32_t ctuAddr = 0; ctuAddr < sps.numCUsInFrame; ctuAddr++)<br>
+ m_picCTU[ctuAddr].initialize(<wbr>m_cuMemPool, 0, param, ctuAddr);<br>
+ else<br>
+ return false;<br>
<br>
CHECKED_MALLOC_ZERO(m_cuStat, RCStatCU, sps.numCUsInFrame);<br>
CHECKED_MALLOC(m_rowStat, RCStatRow, sps.numCuInHeight);<br>
diff --git a/source/encoder/analysis.cpp b/source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp<br>
+++ b/source/encoder/analysis.cpp<br>
</span>@@ -101,15 +101,17 @@<br>
<span class=""> {<br>
ModeDepth &md = m_modeDepth[depth];<br>
<br>
- md.cuMemPool.create(depth, csp, MAX_PRED_TYPES, *m_param);<br>
</span>+ ok &= md.cuMemPool.create(depth, csp, MAX_PRED_TYPES, *m_param);<br>
ok &= md.fencYuv.create(cuSize, csp);<br>
-<br>
- for (int j = 0; j < MAX_PRED_TYPES; j++)<br>
+ if (ok)<br>
<span class=""> {<br>
- md.pred[j].cu.initialize(md.<wbr>cuMemPool, depth, *m_param, j);<br>
</span>- ok &= md.pred[j].predYuv.create(<wbr>cuSize, csp);<br>
- ok &= md.pred[j].reconYuv.create(<wbr>cuSize, csp);<br>
- md.pred[j].fencYuv = &md.fencYuv;<br>
+ for (int j = 0; j < MAX_PRED_TYPES; j++)<br>
+ {<br>
<span class="">+ md.pred[j].cu.initialize(md.<wbr>cuMemPool, depth, *m_param, j);<br>
</span>+ ok &= md.pred[j].predYuv.create(<wbr>cuSize, csp);<br>
+ ok &= md.pred[j].reconYuv.create(<wbr>cuSize, csp);<br>
+ md.pred[j].fencYuv = &md.fencYuv;<br>
+ }<br>
}<br>
}<br>
if (m_param->sourceHeight >= 1080)<br>
<div class="HOEnZb"><div class="h5">diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp<br>
--- a/source/encoder/api.cpp<br>
+++ b/source/encoder/api.cpp<br>
@@ -286,7 +286,7 @@<br>
else if (pi_nal)<br>
*pi_nal = 0;<br>
<br>
- if (numEncoded && encoder->m_param->csvLogLevel)<br>
+ if (numEncoded > 0 && encoder->m_param->csvLogLevel)<br>
x265_csvlog_frame(encoder->m_<wbr>param, pic_out);<br>
<br>
if (numEncoded < 0)<br>
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp<br>
+++ b/source/encoder/encoder.cpp<br>
@@ -1342,7 +1342,9 @@<br>
}<br>
else<br>
{<br>
- frameEnc->allocEncodeData(m_<wbr>reconfigure ? m_latestParam : m_param, m_sps);<br>
+ bool isallocated = frameEnc->allocEncodeData(m_<wbr>reconfigure ? m_latestParam : m_param, m_sps);<br>
+ if (!isallocated)<br>
+ return -1;<br>
Slice* slice = frameEnc->m_encData->m_slice;<br>
slice->m_sps = &m_sps;<br>
slice->m_pps = &m_pps;<br>
</div></div><br>______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">Pushed.</div></div>