diff options
author | Underground78 <underground78@users.sourceforge.net> | 2014-11-10 01:49:19 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2014-11-11 09:17:26 +0300 |
commit | 7e0ae79f3fc242d8f64cfb08ee1c7db1a85ba5d3 (patch) | |
tree | acdafce26100f41815071369ee3a220f2a40fd15 | |
parent | 8bd63f8a7791594af2a9d535df435de6f8a79309 (diff) |
Fix a crash for files with dimensions non-multiple of two.
Always align the plane height to a factor 2.
-rw-r--r-- | decoder/LAVVideo/decoders/pixfmt.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/decoder/LAVVideo/decoders/pixfmt.cpp b/decoder/LAVVideo/decoders/pixfmt.cpp index 3a0670e6..0b1d560c 100644 --- a/decoder/LAVVideo/decoders/pixfmt.cpp +++ b/decoder/LAVVideo/decoders/pixfmt.cpp @@ -102,11 +102,13 @@ HRESULT AllocLAVFrameBuffers(LAVFrame *pFrame, ptrdiff_t stride) stride *= desc.codedbytes; + int alignedHeight = FFALIGN(pFrame->height, 2); + memset(pFrame->data, 0, sizeof(pFrame->data)); memset(pFrame->stride, 0, sizeof(pFrame->stride)); for (int plane = 0; plane < desc.planes; plane++) { ptrdiff_t planeStride = stride / desc.planeWidth[plane]; - size_t size = planeStride * (pFrame->height / desc.planeHeight[plane]); + size_t size = planeStride * (alignedHeight / desc.planeHeight[plane]); pFrame->data[plane] = (BYTE *)_aligned_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE, 64); pFrame->stride[plane] = planeStride; } |