Secugen fingerprint reader using Qt

0

I am trying to create an app using the SecuGen FDX SDK on Qt. I am hving issues capturing an image from the reader. I can access all the functions in the dll without problem, except form the ones involving capturing an image. When I debug the code under Qt creator I get the following:

ModLoad: 00e60000 00f06000   registrationPlatform.exe
ModLoad: 77580000 776bc000   ntdll.dll
ModLoad: 769f0000 76ac4000   C:\Windows\system32\kernel32.dll
ModLoad: 75920000 7596a000   C:\Windows\system32\KERNELBASE.dll
ModLoad: 10000000 1001f000   D:\software\registrationPlatform-build-desktop-Qt_4_8_3-msvc__qmake__Debug\debug\SGFPLIB.DLL
ModLoad: 74bd0000 74bd9000   C:\Windows\system32\VERSION.dll
ModLoad: 76810000 768bc000   C:\Windows\system32\msvcrt.dll
ModLoad: 76ec0000 76f89000   C:\Windows\system32\USER32.dll
ModLoad: 77050000 7709e000   C:\Windows\system32\GDI32.dll
ModLoad: 776d0000 776da000   C:\Windows\system32\LPK.dll
ModLoad: 77710000 777ad000   C:\Windows\system32\USP10.dll
ModLoad: 554d0000 5631e000   D:\software\registrationPlatform-build-desktop-Qt_4_8_3-msvc__qmake__Debug\debug\QtGuid4.dll
ModLoad: 76ad0000 76b4b000   C:\Windows\system32\COMDLG32.dll
ModLoad: 76ff0000 77047000   C:\Windows\system32\SHLWAPI.dll
ModLoad: 74660000 747fe000   C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfc\COMCTL32.dll
ModLoad: 75b10000 76759000   C:\Windows\system32\SHELL32.dll
ModLoad: 76910000 7699f000   C:\Windows\system32\OLEAUT32.dll
ModLoad: 76d20000 76e7c000   C:\Windows\system32\ole32.dll
ModLoad: 770a0000 77141000   C:\Windows\system32\RPCRT4.dll
ModLoad: 776e0000 776ff000   C:\Windows\system32\IMM32.dll
ModLoad: 76c50000 76d1c000   C:\Windows\system32\MSCTF.dll
ModLoad: 71870000 718a2000   C:\Windows\system32\WINMM.dll
ModLoad: 6f500000 6f551000   C:\Windows\system32\WINSPOOL.DRV
ModLoad: 76770000 76810000   C:\Windows\system32\ADVAPI32.dll
ModLoad: 768f0000 76909000   C:\Windows\SYSTEM32\sechost.dll
ModLoad: 569f0000 56e40000   D:\software\registrationPlatform-build-desktop-Qt_4_8_3-msvc__qmake__Debug\debug\QtCored4.dll
ModLoad: 76e80000 76eb5000   C:\Windows\system32\WS2_32.dll
ModLoad: 77700000 77706000   C:\Windows\system32\NSI.dll
ModLoad: 66580000 6664b000   C:\Windows\system32\MSVCP110D.dll
ModLoad: 56850000 569eb000   C:\Windows\system32\MSVCR110D.dll
(758.15c): Break instruction exception - code 80000003 (first chance)
eax=00000000 ebx=00000000 ecx=001af55c edx=775c64f4 esi=fffffffe edi=00000000
eip=7761e60e esp=001af578 ebp=001af5a4 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
ntdll!LdrpDoDebuggerBreak+0x2c:
7761e60e cc              int     3
cdb: Reading initial command '.idle_cmd !qtcreatorcdbext.idle'
Execute when idle: !qtcreatorcdbext.idle
0:000>
<l+t
<l+s
dNOTE: ENGINE SETUP OK
dState changed from EngineSetupRequested(1) to EngineSetupOk(3) [master]
dQUEUE: SETUP INFERIOR
dState changed from EngineSetupOk(3) to InferiorSetupRequested(4) [master]
dQUEUE: SETUP INFERIOR
dCALL: SETUP INFERIOR
<sxn 0x4000001f
<.asm source_line
<!qtcreatorcdbext.pid -t 0
Source options are 1:
  1/t - Step/trace by source line
Source options are 5:
  1/t - Step/trace by source line
  4/s - List source code at prompt
Assembly options: source_line
Qt Creator CDB extension version 0.11 (Qt 5 support) 32 bit built Aug  9 2012.
dTaking notice of pid 1880
dNOTE: INFERIOR SETUP OK
dState changed from InferiorSetupRequested(4) to InferiorSetupOk(6) [master]
dState changed from InferiorSetupOk(6) to EngineRunRequested(7) [master]
dQUEUE: RUN ENGINE
dCALL: RUN ENGINE
<g
dNOTE: ENGINE RUN AND INFERIOR RUN OK
sRunning.
dState changed from EngineRunRequested(7) to InferiorRunOk(11) [master]
ModLoad: 75640000 7568b000   C:\Windows\system32\apphelp.dll
ModLoad: 565f0000 56849000   C:\Windows\AppPatch\AcXtrnal.DLL
FTH: (1880): *** Fault tolerant heap shim applied to current process. This is usually due to previous crashes. ***

ModLoad: 744b0000 744f0000   C:\Windows\system32\uxtheme.dll
ModLoad: 741b0000 741c3000   C:\Windows\system32\dwmapi.dll
ModLoad: 755d0000 755dc000   C:\Windows\system32\CRYPTBASE.dll
("D:/development/Qt/4.8.3-msvc/plugins", "D:/software/registrationPlatform-build-desktop-Qt_4_8_3-msvc__qmake__Debug/debug") 

ModLoad: 00940000 00a30000   D:\software\registrationPlatform-build-desktop-Qt_4_8_3-msvc__qmake__Debug\debug\Sgfu03m.dll
ModLoad: 6dc90000 6dca1000   C:\Windows\system32\winbio.dll
ModLoad: 75750000 7586c000   C:\Windows\system32\CRYPT32.dll
ModLoad: 75740000 7574c000   C:\Windows\system32\MSASN1.dll
ModLoad: 6da50000 6da81000   C:\Windows\system32\credui.dll
ModLoad: 00270000 00290000   D:\software\registrationPlatform-build-desktop-Qt_4_8_3-msvc__qmake__Debug\debug\sgfpaMX.dll 

ModLoad: 750d0000 750e6000   C:\Windows\system32\CRYPTSP.dll
ModLoad: 74ef0000 74f2b000   C:\Windows\system32\rsaenh.dll
ModLoad: 756c0000 756ce000   C:\Windows\system32\RpcRtRemote.dll
ModLoad: 75890000 75914000   C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll
HEAP[registrationPlatform.exe]: 
Heap block at 003D3628 modified at 003D3655 past requested size of 25

(758.15c): Break instruction exception - code 80000003 (first chance)
s
sException at 0x77644684, code: 0x80000003: breakpoint, flags=0x0 in ntdll!RtlpBreakPointHeap
eax=003d3628 ebx=003d3655 ecx=775a07ed edx=001ac329 esi=003d3628 edi=00000025
eip=77644684 esp=001ac570 ebp=001ac570 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!RtlpBreakPointHeap+0x23:
    77644684 cc              int     3
sInterrupted.
dNOTE: INFERIOR SPONTANEOUS STOP
sStopped.
dState changed from InferiorRunOk(11) to InferiorStopOk(14) [master]
<!qtcreatorcdbext.locals -t 1 -D -c -W 9

The specific part of the code causing the issue is the following:

    BYTE *buffer = new BYTE(device_info.ImageHeight*device_info.ImageWidth);

    DWORD timeout = 10000;

    DWORD quality = 30;

    if(SGFPM_GetImageEx(g_Fpm, buffer, timeout, NULL, quality) == SGFDX_ERROR_NONE)
    {        
        //draw image
    }

    delete buffer;
c++
qt
asked on Stack Overflow Nov 28, 2012 by user1861402 • edited Nov 28, 2012 by mnel

1 Answer

0

Change your new and delete to use [ ] instead of ( ). You are actually allocating only one byte and initializing its value to the number of bytes you want. SGFPM_GetImageEx tries to write the image to unallocated memory and crashes.

BYTE *buffer = new BYTE[device_info.ImageHeight*device_info.ImageWidth];
...
delete[] buffer;
answered on Stack Overflow Nov 29, 2012 by (unknown user)

User contributions licensed under CC BY-SA 3.0