Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Yet another buffer overrun...  (Read 2569 times)

0 Members and 1 Guest are viewing this topic.

trevorade

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Yet another buffer overrun...
« on: August 31, 2013, 08:40:20 am »
Hey all, I'm just starting to use SFML with VS++11 (2012) and have run into the infamous windows buffer overrun bug.  I'm actually using Eclipse CDT but am using the Visual C++ toolchain.

This is the version I'm using of SFML:
SFML-2.1-windows-vc11-32bits

This the version of cl I'm using:
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.51106.1 for x86

I have copied the following DLL's to my exe's dir:
libsndfile-1.dll
openal32.dll
sfml-audio-d-2.dll
sfml-graphics-d-2.dll
sfml-network-d-2.dll
sfml-system-d-2.dll
sfml-window-d-2.dll


Here are the commands I'm using to build it:
cl /c /EHs /MD /Zi /DSFML_DYNAMIC "/IE:\\DevTools\\SFML-2.1-windows-vc11-32bits\\include" /nologo "/Fosrc\\Hello.obj" "..\\src\\Hello.cpp"
link /debug /nologo "/libpath:E:\\DevTools\\SFML-2.1-windows-vc11-32bits\\include" /OUT:Hello.exe "src\\Hello.obj" "E:\\DevTools\\SFML-2.1-windows-vc11-32bits\\lib\\sfml-audio-d.lib" "E:\\DevTools\\SFML-2.1-windows-vc11-32bits\\lib\\sfml-graphics-d.lib" "E:\\DevTools\\SFML-2.1-windows-vc11-32bits\\lib\\sfml-main-d.lib" "E:\\DevTools\\SFML-2.1-windows-vc11-32bits\\lib\\sfml-network-d.lib" "E:\\DevTools\\SFML-2.1-windows-vc11-32bits\\lib\\sfml-system-d.lib" "E:\\DevTools\\SFML-2.1-windows-vc11-32bits\\lib\\sfml-window-d.lib"


My guess is there's some flag in here different from what the lib files were built with for debug which is causing issues due to CDT default flags for cl and link differing.

I followed the tutorial here http://www.sfml-dev.org/tutorials/2.1/start-vc.php and am running the exact sample program listed at the bottom.

I'd rather not recompile SFML if possible (I've seen that listed as the solution to this problem a few times).

Thanks in advance!
« Last Edit: August 31, 2013, 08:44:14 am by trevorade »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: Yet another buffer overrun...
« Reply #1 on: August 31, 2013, 08:58:40 pm »
infamous windows buffer overrun bug
No idea really what you're talking about here, maybe giving us the error message/crash/traceback/etc... ;)

Also rebuilding SFML is always worth trying and it's really rather easy, just create an NMake make file with CMake and then run it with the command nmake install and you're done! :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

trevorade

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Yet another buffer overrun...
« Reply #2 on: August 31, 2013, 09:54:52 pm »
It's come up a lot, that's why I called it infamous.
http://google.com/#q=site:en.sfml-dev.org%2Fforums+buffer+overrun

Basically, you build the sample program, it runs with the green circle and SFML Works! window title, and then crashes with a buffer overrun whenever you try to close the window or resize it.

The problem appears to occur when you have a mismatch between: debug/release, static/dynamic, or between different VS compiler versions.

Based on the info I posted, I'm pretty sure that I'm using the correct lib and dll files.  There's something else causing the issue.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Yet another buffer overrun...
« Reply #3 on: September 01, 2013, 11:35:39 am »
It's come up a lot, that's why I called it infamous.
You know that "buffer overrun" is almost the same as "buffer overflow" (one comes from reading the other from writing) and is probably the most generic term for "the program screwed up somewhere". Calling it infamous is akin to this: http://xkcd.com/1022/

cl /c /EHs /MD /Zi /DSFML_DYNAMIC
/c -- compile only, no link
/EHs -- Synchronous exception handling
/MD -- Multi-Threaded DLL, not debug
/Zi -- Produce standard program database for debugging (PDB)
/DSFML_DYNAMIC -- ? ? ? ? ? ? ? ? ? ?, this surely did not come from the Eclipse CDT or the 2.1 tutorial....

Fix up your configuration and use /MDd or whatever works with the precompiled library, /D "_DEBUG" might also help. The flags as they are are a mess now anyway. If you don't want to build with Visual Studio to use its default flags or generate an example solution from CMake just to have a look at the flags used by SFML when its built, you are out of luck and basically have to guess what works.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).