A minior bug in UMC::H264VideoEncoder, occupying when close then delete

A minior bug in UMC::H264VideoEncoder, occupying when close then delete

Hi

I found a minior bug in UMC::H264VideoEncoder, the example is modify from http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-...

void EncodeStream(Ipp8u *cYUVData, int imgWidth, int imgHeight, int frameNumber,
Ipp8u *cVideoData,int &VideoDataSize )
{

UMC::Status status;
UMC::MediaData DataOut; UMC::VideoData DataIn;
int FrameSize;

UMC::H264EncoderParams Params;
UMC::H264VideoEncoder *H264Encoder;

H264Encoder = new UMC::H264VideoEncoder;

Params.key_frame_controls.method=1;
Params.info.clip_info.height=imgHeight;
Params.info.clip_info.width=imgWidth;
Params.info.bitrate = 1000000;
Params.numThreads = 1;

if((status = H264Encoder->Init(&Params))!=UMC::UMC_OK)
return;

FrameSize = imgWidth*imgHeight*3/2;
DataIn.Init(imgWidth,imgHeight,UMC::YV12,8);
DataIn.SetBufferPointer(cYUVData,FrameSize);
DataIn.SetDataSize(FrameSize);

DataOut.SetBufferPointer(cVideoData,MAXVIDEOSIZE);

VideoDataSize=0;
int nEncodedFrames=0;
while ( nEncodedFrames < frameNumber)
{
status = H264Encoder->GetFrame(&DataIn, &DataOut);
if (status == UMC::UMC_OK)
{
nEncodedFrames++;

VideoDataSize+=DataOut.GetDataSize();
DataOut.MoveDataPointer(DataOut.GetDataSize());

cYUVData+=FrameSize;
DataIn.SetBufferPointer(cYUVData,FrameSize);
DataIn.SetDataSize(FrameSize);
}
}

H264Encoder->Close();
delete H264Encoder;

return;
}

then the program would crash in excuting delete H264Encoder, on H264ENC_MAKE_NAME in umc_h264_enc_cpb_tmp1.cpp.h for accessing a freed memory.

it is becouse the m_pEncoder_8u_16s is not been set as NULL.

thank you.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thanks for reporting that issue. We will fix the problem.

Regards,
Vladimir

Hi Gaiger,

The fix has been included into 7.0.2 release. Thanks for your report.

Thanks,
Chao

Leave a Comment

Please sign in to add a comment. Not a member? Join today