Fix libagg crashes on 64bit

Putting a "\n" in OSDCLASS->addLine SIGSEGVs.

A newline is 10 in ASCII while the libagg's font starts
from a 32 (a space), so it nicely underflows and accesses
out-of-bounds memory in agg_glyph_raster_bin.h:90:

m_font + 4 + (glyph - start_char) * 2
m_font + 4 + (16 - 32) * 2

Should fix #2829308

Patch from kouteiheika, #3407304
This commit is contained in:
riccardom 2011-09-12 17:37:28 +00:00
parent 14cd6b722c
commit 375fa0c94f
3 changed files with 11 additions and 11 deletions

View File

@ -436,7 +436,7 @@ process_ctrls_event( SDL_Event& event,
if (event.active.gain) {
cfg->focused = 1;
SPU_Pause(0);
osd->addLine("Auto pause disabled\n");
osd->addLine("Auto pause disabled");
} else {
cfg->focused = 0;
SPU_Pause(1);
@ -470,18 +470,18 @@ process_ctrls_event( SDL_Event& event,
cfg->fake_mic = !cfg->fake_mic;
Mic_DoNoise(cfg->fake_mic);
if (cfg->fake_mic)
osd->addLine("Fake mic enabled\n");
osd->addLine("Fake mic enabled");
else
osd->addLine("Fake mic disabled\n");
osd->addLine("Fake mic disabled");
break;
#endif
case SDLK_o:
cfg->boost = !cfg->boost;
if (cfg->boost)
osd->addLine("Boost mode enabled\n");
osd->addLine("Boost mode enabled");
else
osd->addLine("Boost mode disabled\n");
osd->addLine("Boost mode disabled");
break;
case SDLK_LSHIFT:

View File

@ -2004,10 +2004,10 @@ static void ToggleAudio (GtkToggleAction *action)
{
if (gtk_toggle_action_get_active(action) == TRUE) {
SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4);
osd->addLine("Audio enabled\n");
osd->addLine("Audio enabled");
} else {
SPU_ChangeSoundCore(0, 0);
osd->addLine("Audio disabled\n");
osd->addLine("Audio disabled");
}
}
@ -2018,9 +2018,9 @@ static void ToggleMicNoise (GtkToggleAction *action)
Mic_DoNoise(doNoise);
if (doNoise)
osd->addLine("Fake mic enabled\n");
osd->addLine("Fake mic enabled");
else
osd->addLine("Fake mic disabled\n");
osd->addLine("Fake mic disabled");
}
#endif

View File

@ -680,12 +680,12 @@ void DesmumeFrame::Modify_AudioDriver(wxCommandEvent &event)
switch (selection) {
case AUDIODRIVER_DISABLE:
SPU_ChangeSoundCore(0, 0);
osd->addLine("Audio disabled\n");
osd->addLine("Audio disabled");
break;
default:
case AUDIODRIVER_SDL:
SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4);
osd->addLine("Audio enabled (SDL driver)\n");
osd->addLine("Audio enabled (SDL driver)");
break;
}
}