[libav-bugs] [Bug 487] New: scale from RGB24 crash

bugzilla-daemon at aruru.libav.org bugzilla-daemon at aruru.libav.org
Sat Apr 6 07:56:40 CEST 2013


           Summary: scale from RGB24 crash
           Product: Libav
           Version: git HEAD
          Platform: X86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: libswscale
        AssignedTo: bugzilla at libav.org
        ReportedBy: wangym at gmail.com

Hello, I try use swscale to scale image with format RGB24.
But the programe crashed in function sws_scale.
I found sws_scale try to visit the memory after picture end.(here, pData +
vi->biWidth * 3). 
So I try to alloc a bigger memory, just add 1 line space.
The swscale works fine.
This problem not exists in format RGB32 and YUV422 as I tested. 
Please check. Thanks.
Followed my test code
    case AV_PIX_FMT_RGB24:
            //the followed 4 line copy memory to a bigger to to make swscale
            if (vecTempBuffer_.size() < vi->biWidth * (vi->biHeight + 1) * 3)
                vecTempBuffer_.resize(vi->biWidth * (vi->biHeight + 1) * 3);
            memcpy(&vecTempBuffer_[0], pData, vi->biWidth * vi->biHeight * 3);
            pData = &vecTempBuffer_[0];

            plane[0]        = (unsigned char*)pData;
            i_stride[0]     = vi->biWidth * 3;

            outdata[0]      = pbResizeBuffer_;
            size[0]         = 3 * encparam_.width;

    pResizeContext_ = sws_getCachedContext(pResizeContext_, vi->biWidth,
vi->biHeight, srcfmt_,
        encparam_.width, encparam_.height, srcfmt_, SWS_BICUBIC, 0, 0, 0);

    sws_scale(pResizeContext_, plane, i_stride, 0, vi->biHeight, outdata,


Configure bugmail: https://bugzilla.libav.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the libav-bugs mailing list