Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnderground78 <underground78@users.sourceforge.net>2014-11-10 01:49:19 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2014-11-11 09:17:26 +0300
commit7e0ae79f3fc242d8f64cfb08ee1c7db1a85ba5d3 (patch)
treeacdafce26100f41815071369ee3a220f2a40fd15 /decoder
parent8bd63f8a7791594af2a9d535df435de6f8a79309 (diff)
Fix a crash for files with dimensions non-multiple of two.
Always align the plane height to a factor 2.
Diffstat (limited to 'decoder')
-rw-r--r--decoder/LAVVideo/decoders/pixfmt.cpp4
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;
}