Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[fix] ffmpeg uses a 16-byte stride when scaling images, which can ove…

…rrun the texture buffer which is only 2-byte aligned, causing a segfault on OSX/iOS
  • Loading branch information...
commit 2a3ad143576fe3cdfb869126258e5f041f6794a1 1 parent 37f3554
night199uk night199uk authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 xbmc/guilib/Texture.cpp
6 xbmc/guilib/Texture.cpp
View
@@ -87,7 +87,11 @@ void CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned in
// we crash in CPicture::ScaleImage in ffmpegs swscale
// because it tries to access beyond the source memory
// (happens on osx and ios)
- m_textureWidth = ((m_textureWidth + 1) / 2) * 2;
+ // UPDATE: don't just update to be on an even width;
+ // ffmpegs swscale relies on a 16-byte stride on some systems
+ // so the textureWidth needs to be a multiple of 16. see ffmpeg
+ // swscale headers for more info.
+ m_textureWidth = ((m_textureWidth + 15) / 16) * 16;
}
// check for max texture size

1 comment on commit 2a3ad14

Memphiz
Owner

awesome catch - thx - this should fix software rendering on those systems :)

Please sign in to comment.
Something went wrong with that request. Please try again.