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

Author Topic: Stack corruption bug with sf::Shape  (Read 1719 times)

0 Members and 1 Guest are viewing this topic.

heishe

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Stack corruption bug with sf::Shape
« on: November 18, 2012, 10:30:45 pm »
I posted this in General since it might be a VS2012 bug.

Basically, in any function that looks like this:

void func()
{
   sf::RectangleShape foo; //can be any kind of shape
}

The code will crash upon exiting the func() function, because foo creates a stack corruption. This is with Visual Studio 2012, standard compiler, SFML2 RC (downloaded like a week ago).

It should be noted that the same happens when I used a dynamically allocated shape that I delete at the end of the function. But instead of a stack corruption, it will be a heap corruption, of course.

Any idea what could be the cause of this?

When debugging, it seems like the shape isn't initialized correctly. The vectors inside the attributes of sf::Shape have weird sizes (e.g. 6 and 12) and the values of their elements seem like "undefined behavior' kind of values.
« Last Edit: November 18, 2012, 10:43:37 pm by heishe »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Stack corruption bug with sf::Shape
« Reply #1 on: November 18, 2012, 10:39:42 pm »
This is with Visual Studio 2012, standard compiler, SFML2 RC (downloaded like a week ago).
Does that mean you downloaded it from the official download page or from GitHub and built it yourself?
Because for VS 2012 you have to build SFML newly (or use my nightly builds).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything