> I've compiled an example program from O'Reilly book which uses basic 
> socket BIO routines. But it crashes when executed with memory access 
> exception in function BIO_new_accept.
> I used Openssl-1.0.0-beta4 built under win32 (windows XP SP3) using MSVC 
> 2005 as described in INSTALL.W32:
> 
> $ perl Configure VC-WIN32 enable-static-engine
> $ ms\do_nasm.bat
> $ nmake -f ms\ntdll.mak
> 
> The error is caused by a dynamic call of WINAPI function getaddrinfo. 
> This function uses stdcall call convention, but called as cdecl.
> 
> MSVC
> 
> 1004F8F3    51              PUSH ECX
> 1004F8F4    56              PUSH ESI
> 1004F8F5    53              PUSH EBX
> 1004F8F6    FF15 3CE81110   CALL DWORD PTR DS:[1011E83C]             ; 
> WS2_32.getaddrinfo
> 1004F8FC    83C4 10         ADD ESP,10                               ; 
> stack was damaged
> 1004F8FF    85C0            TEST EAX,EAX
> 1004F901    0F84 AF000000   JE LIBEAY32.1004F9B6
> ...
> 1004F9B6    8B7424 14       MOV ESI,DWORD PTR SS:[ESP+14]         
> 1004F9BA    8B46 10         MOV EAX,DWORD PTR DS:[ESI+10]            ; 
> exception here
> 1004F9BD    83F8 1C         CMP EAX,1C
> 1004F9C0    76 05           JBE SHORT LIBEAY32.1004F9C7
> 
> 
> As a result the stack is damaged and the pointer to the returned value, 
> which address is in a stack, is bad, thus leading to exception.

Good catch. Addressed in http://cvs.openssl.org/chngview?cn=19023. For
reference. The reason I've chosen WSAAPI and refer to "[non-]WinSock
platforms" in comment is presence of WinSock calls guarded by
OPENSSL_SYS_NETWARE. Either way, case is being dismissed. Thanks for
report. A.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to