Skip to content

Commit

Permalink
Merge pull request xbmc#18945 from fritsch/mtrix
Browse files Browse the repository at this point in the history
DVDFileInfo: Consult av_image_get_buffer_size before allocating
  • Loading branch information
fritsch committed Dec 21, 2020
2 parents 39d0d50 + 78d2eb9 commit 9aafe58
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xbmc/cores/VideoPlayer/DVDFileInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ bool CDVDFileInfo::ExtractThumb(const CFileItem& fileItem,
aspect = hint.aspect;
unsigned int nHeight = (unsigned int)((double)nWidth / aspect);

uint8_t *pOutBuf = (uint8_t*)av_malloc(nWidth * nHeight * 4);
// We pass the buffers to sws_scale uses 16 aligned widths when using intrinsics
int sizeNeeded = FFALIGN(nWidth, 16) * nHeight * 4;
uint8_t *pOutBuf = static_cast<uint8_t*>(av_malloc(sizeNeeded));
struct SwsContext *context = sws_getContext(picture.iWidth, picture.iHeight,
AV_PIX_FMT_YUV420P, nWidth, nHeight, AV_PIX_FMT_BGRA, SWS_FAST_BILINEAR, NULL, NULL, NULL);

Expand Down

0 comments on commit 9aafe58

Please sign in to comment.