pcsx2: fix 4 arrays out of bond

Gsdx: fix a memcpy src/dst overlap + a clang compilation fix



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5726 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2013-09-05 20:01:47 +00:00
parent e01c6cd9ce
commit fb684df32b
5 changed files with 13 additions and 2 deletions

View File

@ -233,7 +233,8 @@ void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini )
IniEntry( FramerateNTSC );
IniEntry( FrameratePAL );
static const wxChar * const ntsc_pal_str[2] = { L"ntsc", L"pal" };
// WARNING: array must be NULL terminated to compute it size
static const wxChar * const ntsc_pal_str[3] = { L"ntsc", L"pal", NULL };
ini.EnumEntry( L"DefaultRegionMode", DefaultRegionMode, ntsc_pal_str, DefaultRegionMode );
IniEntry( FramesToDraw );

View File

@ -518,6 +518,8 @@ void App_LoadSaveInstallSettings( IniInterface& ini )
{
L"User",
L"Custom",
// WARNING: array must be NULL terminated to compute it size
NULL
};
ini.EnumEntry( L"DocumentsFolderMode", DocsFolderMode, DocsFolderModeNames, (InstallationMode == InstallMode_Registered) ? DocsFolder_User : DocsFolder_Custom);
@ -822,6 +824,8 @@ void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini )
L"Stretch",
L"4:3",
L"16:9",
// WARNING: array must be NULL terminated to compute it size
NULL
};
ini.EnumEntry( L"AspectRatio", AspectRatio, AspectRatioNames, AspectRatio );

View File

@ -323,6 +323,7 @@ public:
}
};
// WARNING ConsoleLogSources & ConLogDefaults must have the same size
static ConsoleLogSource* const ConLogSources[] =
{
(ConsoleLogSource*)&SysConsole.eeConsole,
@ -335,6 +336,7 @@ static ConsoleLogSource* const ConLogSources[] =
(ConsoleLogSource*)&pxConLog_Thread,
};
// WARNING ConsoleLogSources & ConLogDefaults must have the same size
static const bool ConLogDefaults[] =
{
true,
@ -343,6 +345,8 @@ static const bool ConLogDefaults[] =
true,
false,
false,
false,
false
};
void ConLog_LoadSaveSettings( IniInterface& ini )

View File

@ -1062,7 +1062,8 @@ void GSTextureCache::Source::Flush(uint32 count)
if(count < m_write.count)
{
memcpy(&m_write.rect[0], &m_write.rect[count], (m_write.count - count) * sizeof(m_write.rect[0]));
// Warning src and destination overlap. Memmove must be used instead of memcpy
memmove(&m_write.rect[0], &m_write.rect[count], (m_write.count - count) * sizeof(m_write.rect[0]));
}
m_write.count -= count;

View File

@ -71,6 +71,7 @@ typedef signed long long int64;
#include <time.h>
#include <limits.h>
#include <complex>
#include <cstring>
#include <string>
#include <vector>