diff options
author | Rodger Combs <rodger.combs@gmail.com> | 2018-07-01 04:56:08 -0500 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2018-10-02 00:42:58 +0300 |
commit | 008ddf42a1adc0a5835d11a8598b86f29d6dad78 (patch) | |
tree | b102abf78a14fc90ff496aafe0264a9987233f79 /osdep | |
parent | 5b9cf1d0a6629ac0b657aa3bd5bbbcac161c8a15 (diff) | |
download | mpv-008ddf42a1adc0a5835d11a8598b86f29d6dad78.tar.bz2 mpv-008ddf42a1adc0a5835d11a8598b86f29d6dad78.tar.xz |
{mac,cocoa}: trim trailing null out of macosx_icon when loading it
This prevents crashes when loading the application icon image.
Suggested-by: Akemi <der.richter@gmx.de>
(cherry picked from commit 1842a932d37638c910f4471d85e81554076c3d2c)
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/macosx_application.m | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index ca613e04f4..086d51fef3 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -127,8 +127,9 @@ static const char macosx_icon[] = - (NSImage *)getMPVIcon { + // The C string contains a trailing null, so we strip it away NSData *icon_data = [NSData dataWithBytesNoCopy:(void *)macosx_icon - length:sizeof(macosx_icon) + length:sizeof(macosx_icon) - 1 freeWhenDone:NO]; return [[NSImage alloc] initWithData:icon_data]; } |