diff --git a/third_party/libmodplug/src/load_ult.cpp b/third_party/libmodplug/src/load_ult.cpp index 83024f2..65f4a14 100644 --- a/third_party/libmodplug/src/load_ult.cpp +++ b/third_party/libmodplug/src/load_ult.cpp @@ -64,16 +64,17 @@ BOOL CSoundFile::ReadUlt(const BYTE *lpStream, DWORD dwMemLength) if ((pmh->reserved) && (dwMemPos + pmh->reserved * 32 < dwMemLength)) { UINT len = pmh->reserved * 32; - m_lpszSongComments = new char[len + 1 + pmh->reserved]; - if (m_lpszSongComments) - { - for (UINT l=0; lreserved; l++) + try { + m_lpszSongComments = new char[len + 1 + pmh->reserved]; + for (UINT l = 0; l < pmh->reserved; l++) { - memcpy(m_lpszSongComments+l*33, lpStream+dwMemPos+l*32, 32); - m_lpszSongComments[l*33+32] = 0x0D; + memcpy(m_lpszSongComments + l * 33, lpStream + dwMemPos + l * 32, 32); + m_lpszSongComments[l * 33 + 32] = 0x0D; } m_lpszSongComments[len] = 0; } + catch (std::bad_alloc& ba) { + } dwMemPos += len; } if (dwMemPos >= dwMemLength) return TRUE; diff --git a/third_party/libmodplug/src/sndfile.h b/third_party/libmodplug/src/sndfile.h index c009265..84592ca 100644 --- a/third_party/libmodplug/src/sndfile.h +++ b/third_party/libmodplug/src/sndfile.h @@ -13,6 +13,8 @@ #ifndef __SNDFILE_H #define __SNDFILE_H +#include + #ifdef UNDER_CE int _strnicmp(const char *str1,const char *str2, int n); #endif