EXCEPTION_INT_DIVIDE_BY_ZERO occurs in libOOOGG when encoding
This problem has been fazing me for a while.
I am working with the latest binaries, version 0.81.15562, 2008-12-06. downloaded from http://downloads.xiph.org/releases/oggdsf/oggcodecs_0.81.15562-win32.exe
I am writing some stuff to convert audio files into ogg format by using DirectShow Filters.
For example. The filter is connected as: Files --> MEPG Spliter --> MEPG DECODER --> Audio Resampler Filter --> Vorbis Encoder Filter --> OGG Mux Filter
If I launch the exe in VisualStudio, everything works correctly. If I launch the exe not in debug mode,(by clicking), it will crash.
Then I found that: an EXCEPTION_INT_DIVIDE_BY_ZERO exception will threw from libOOOGG. If the debugger ignores this exception and continue, everyting works and keep find. Otherwise, the whole process will crash.
I will post more details below
When exception threw out, a Dialog box will show:
Unhandled exception at 0x01366f9b in AudioFormatConvertorD.exe: 0xC0000094: Integer division by zero.
Then look into the stack trace window.
> libOOOgg.dll!01366f9b() *<-- crash here!!!*
[Frames below may be incorrect and/or missing, no symbols loaded for libOOOgg.dll]
libOOOgg.dll!0136222f()
libOOOgg.dll!0136217a()
libOOOgg.dll!01364df7()
libOOOgg.dll!01362354()
libOOOgg.dll!01364ea8()
libOOOgg.dll!013649d9()
libOOOgg.dll!01361fc0()
libOOOgg.dll!01365670()
libOOOgg.dll!01365875()
libOOOgg.dll!0136578a()
libOOOgg.dll!0136544b()
dsfOggMux.dll!013a39fc()
dsfOggMux.dll!013a6bd2()
dsfVorbisEncoder.dll!01328da2()
dsfVorbisEncoder.dll!01322e90()
dsfVorbisEncoder.dll!013228a6()
dsfVorbisEncoder.dll!0132478b()
================ OK, now I must ignore this exception by writing my own debugger.
STARTUPINFO stInfo = {0};
stInfo.cb = sizeof(stInfo);
PROCESS_INFORMATION stProcInfo = {0};
BOOL bRet = ::CreateProcess( NULL
, strCmdLine.GetBuffer()
, NULL
, NULL
, FALSE
, 0
, NULL
, g_oApp.GetModulePath()
, &stInfo
, &stProcInfo
);
strCmdLine.ReleaseBuffer();
DWORD dwContinueStatus = DBG_CONTINUE;
BOOL bExit = FALSE;
while(!bExit)
{
DEBUG_EVENT stDebugEvt = {0};
::WaitForDebugEvent(&stDebugEvt, INFINITE);
switch (stDebugEvt.dwDebugEventCode)
{
case EXCEPTION_DEBUG_EVENT:
switch(stDebugEvt.u.Exception.ExceptionRecord.ExceptionCode)
{
case EXCEPTION_INT_DIVIDE_BY_ZERO:
dwContinueStatus = DBG_CONTINUE; // <-- ignore
break;
default:
break;
}
break;
case LOAD_DLL_DEBUG_EVENT:
CloseHandle(stDebugEvt.u.LoadDll.hFile);
break;
case CREATE_PROCESS_DEBUG_EVENT :
CloseHandle(stDebugEvt.u.CreateProcessInfo.hFile);
break;
case EXIT_PROCESS_DEBUG_EVENT:
bExit = TRUE;
break;
default:
dwContinueStatus = DBG_CONTINUE;
break;
}
::ContinueDebugEvent( stDebugEvt.dwProcessId, stDebugEvt.dwThreadId, dwContinueStatus);
}
===================== I can repeat this problem in both of my Win2K3 PCs. OS Windows 2003 R2(SP2) and upgraded by "Windows Update". The CPU on my first PC is Intel Pentium D. The other CPU on my 2nd PC is Inter Core2 E6300.