Add some code protection into FrameCrop module

This commit is contained in:
2017-12-18 23:25:45 +00:00
parent 25a4e9765f
commit c560449fbf
+6 -6
View File
@@ -50,14 +50,14 @@ FrameCrop::FrameCrop()
Void FrameCrop::create( PlaYUVerFrame* frame )
{
m_pcCropedFrame = NULL;
if( m_iXSize == -1 )
{
if( m_uiXPosition >= frame->getWidth() )
m_uiXPosition = 0;
if( m_uiYPosition >= frame->getHeight() )
m_uiXPosition = 0;
if( m_iXSize == -1 || ( m_uiXPosition + m_iXSize ) >= frame->getWidth() )
m_iXSize = frame->getWidth() - m_uiXPosition;
}
if( m_iYSize == -1 )
{
if( m_iYSize == -1 || ( m_uiYPosition + m_iYSize ) >= frame->getHeight() )
m_iYSize = frame->getHeight() - m_uiYPosition;
}
m_pcCropedFrame = new PlaYUVerFrame( m_iXSize, m_iYSize, frame->getPelFormat(), frame->getBitsPel() );
}