diff options
| author | drkiiraziel <drkiiraziel@gmail.com> | 2008-11-15 02:30:29 +0000 |
|---|---|---|
| committer | drkiiraziel <drkiiraziel@gmail.com> | 2008-11-15 02:30:29 +0000 |
| commit | 9a4dc4e8102d10feef3d324ace7a3198013c5bd6 (patch) | |
| tree | e31cc8110aeb8ae0c5e0ad1cc2182482c51eb1d3 /Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp | |
| parent | ab1774b28a6a7cbdf52e9114ef323bee067e387c (diff) | |
Fixed small buffer overruns and other minor bugs that were found by VS2008 code analysis
Added a check on both video plugins to prevent crashing when Memory_GetPtr retuns null pointer at ExecuteDisplayList (invalid address? Dave Mirra BMX 2 crashes there ...)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1179 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp')
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp index f65714bf49..f46302c6b9 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp @@ -51,20 +51,25 @@ static void ExecuteDisplayList(u32 address, u32 size) u8* old_pVideoData = g_pVideoData;
u8* startAddress = Memory_GetPtr(address);
- g_pVideoData = startAddress;
- // temporarily swap dl and non-dl (small "hack" for the stats)
- Statistics::SwapDL();
-
- while ((u32)(g_pVideoData - startAddress) < size)
- {
- Decode();
- }
- INCSTAT(stats.numDListsCalled);
- INCSTAT(stats.thisFrame.numDListsCalled);
+ //Avoid the crash if Memory_GetPtr failed ..
+ if (startAddress!=0)
+ {
+ g_pVideoData = startAddress;
- // un-swap
- Statistics::SwapDL();
+ // temporarily swap dl and non-dl (small "hack" for the stats)
+ Statistics::SwapDL();
+
+ while ((u32)(g_pVideoData - startAddress) < size)
+ {
+ Decode();
+ }
+ INCSTAT(stats.numDListsCalled);
+ INCSTAT(stats.thisFrame.numDListsCalled);
+
+ // un-swap
+ Statistics::SwapDL();
+ }
// reset to the old pointer
g_pVideoData = old_pVideoData;
|
