[x265] fix: Bus error

Satoshi Nakagawa nakagawa424 at oki.com
Wed Jun 4 08:00:39 CEST 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1401861502 -32400
#      Wed Jun 04 14:58:22 2014 +0900
# Node ID dbddb764220b340044f25bd47a07949a77b1b827
# Parent  f2479eb454b0ef50e50a7df5ab877ced2cfe5db6
fix: uninitialized read m_totalFrameThreads

diff -r f2479eb454b0 -r dbddb764220b source/Lib/TLibEncoder/NALwrite.cpp
--- a/source/Lib/TLibEncoder/NALwrite.cpp	Tue Jun 03 15:24:22 2014 -0500
+++ b/source/Lib/TLibEncoder/NALwrite.cpp	Wed Jun 04 14:58:22 2014 +0900
@@ -108,7 +108,7 @@
         }
 
         uint32_t i = packetSize;
-        out = (uint8_t*)realloc(out, nalsize + 4);
+        out = (uint8_t*)realloc(out, packetSize + nalsize + 4);
         memcpy(out + packetSize, emulation, nalsize);
         packetSize += nalsize;
 
diff -r f2479eb454b0 -r dbddb764220b source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue Jun 03 15:24:22 2014 -0500
+++ b/source/encoder/encoder.cpp	Wed Jun 04 14:58:22 2014 +0900
@@ -174,6 +174,7 @@
 
 void Encoder::init()
 {
+    m_totalFrameThreads = param->frameNumThreads;
     if (m_frameEncoder)
     {
         int numRows = (param->sourceHeight + g_maxCUSize - 1) / g_maxCUSize;
@@ -189,7 +190,6 @@
     m_rateControl->init(&m_frameEncoder[0].m_sps);
     m_lookahead->init();
     m_encodeStartTime = x265_mdate();
-    m_totalFrameThreads = param->frameNumThreads;
 }
 
 int Encoder::getStreamHeaders(NALUnitEBSP **nalunits)


More information about the x265-devel mailing list