I am doing a project with C++ and SFML, compiled with gcc version 6.3.0 (MinGW.org GCC-6.3.0-1), a dungeon crawler game. I am trying to create a layout by a bidimensional vector of Rooms (a class I also made, header is Room::Room(std::string layout)), and the layouts are created via a seed that stablishes the characteristics of any room, this is separated room-by-room with a slash symbol (/)
I start by reading the seed until it finds the slash, then it creates an instance of Room and adds it into the vector
/* Get Level Layout */
layout = getLayout(level); //Calls SQLite DB
layout_dim = getLayoutDim(level); //Calls SQLite DB
rows = layout_dim[0];
cols = layout_dim[1];
std::vector<std::vector<Room*>> layout_2d(rows);
std::string acumul = "";
int current_row = 0;
int current_col = 0;
for (size_t i = 0; i < strlen(layout.c_str()); i++){
if(layout[i] == '/'){
Room* r = new Room(acumul);
layout_2d[current_row][current_col] = r;
if(current_col + 1 == cols){ //That was last column on the row
current_row ++;
current_col = 0;
}
else{
current_col ++;
}
acumul = "";
}
else{
acumul = acumul + layout[i];
}
}
When it starts to create the instance, (Room* r = new Room(acumul);) everything goes as expected, the "seed" for the room "0 1001 0 0" is OK
npos:4294967295
_M_dataplus
std::allocator<char> (base):
std::allocator<char>
_M_p:
0x8bdd98 "0 1001 0 0"
_M_string_length: 10
But when it enters the constructor of class Room, changes into this
npos: 4294967295
_M_dataplus
std::allocator<char> (base):
std::allocator<char>
_M_p:
0x8bddd0 "�"
_M_string_length: 9166224
Looking at the Hex Editor that comes with VS Code, looks like the pointer has moved:
Here it is when goes OK

Ask me if you need more info, and thanks in advance
EDIT: I have the following trace when I launch with properties -fsanitize=address,undefined -Wall -Wextra
g++ main.cpp sMenu.cpp sSettings.cpp sGame.cpp Room.cpp ConfigFile.cpp common.cpp db.cpp sqlite3.o -fdiagnostics-color=always -fsanitize=address,undefined -Wall -Wextra -o C:\Users\ricc_\Documents\Proyectos\Development\madou4cplusplus\src\..\dist\madou4.exe -L..\lib -I..\include -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system -g
sGame.cpp: In member function 'int sGame::getDataFromSeed(int)':
sGame.cpp:32:32: warning: unused parameter 'seed' [-Wunused-parameter]
int sGame::getDataFromSeed(int seed){
^~~~
sGame.cpp: In member function 'virtual std::__cxx11::string sGame::Run(sf::RenderWindow&)':
sGame.cpp:72:19: warning: unused variable 'r' [-Wunused-variable]
Room* r = new Room(acumul);
^
common.cpp: In function 'std::__cxx11::wstring FromUTF8(const char*)':
common.cpp:69:61: warning: comparison is always true due to limited range of data type [-Wtype-limits]
else if(std::numeric_limits<wchar_t>::max() < 0x110000){
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
db.cpp: In function 'int emptyCallback(void*, int, char**, char**)':
db.cpp:7:32: warning: unused parameter 'data' [-Wunused-parameter]
static int emptyCallback(void* data, int argc, char** argv, char** azColName){
^~~~
db.cpp:7:42: warning: unused parameter 'argc' [-Wunused-parameter]
static int emptyCallback(void* data, int argc, char** argv, char** azColName){
^~~~
db.cpp:7:55: warning: unused parameter 'argv' [-Wunused-parameter]
static int emptyCallback(void* data, int argc, char** argv, char** azColName){
^~~~
db.cpp:7:68: warning: unused parameter 'azColName' [-Wunused-parameter]
static int emptyCallback(void* data, int argc, char** argv, char** azColName){
^~~~~~~~~
db.cpp: In function 'int langGetCallback(void*, int, char**, char**)':
db.cpp:16:34: warning: unused parameter 'data' [-Wunused-parameter]
static int langGetCallback(void* data, int argc, char** argv, char** azColName){
^~~~
db.cpp:16:70: warning: unused parameter 'azColName' [-Wunused-parameter]
static int langGetCallback(void* data, int argc, char** argv, char** azColName){
^~~~~~~~~
db.cpp: In function 'std::__cxx11::string* langGet(std::__cxx11::string, int)':
db.cpp:33:9: warning: unused variable 'rc' [-Wunused-variable]
int rc = sqlite3_exec(DB, sql.c_str(), langGetCallback, (void*)"", NULL);
^~
db.cpp: In function 'int configSingleGetCallback(void*, int, char**, char**)':
db.cpp:42:42: warning: unused parameter 'data' [-Wunused-parameter]
static int configSingleGetCallback(void* data, int argc, char** argv, char** azColName){
^~~~
db.cpp:42:78: warning: unused parameter 'azColName' [-Wunused-parameter]
static int configSingleGetCallback(void* data, int argc, char** argv, char** azColName){
^~~~~~~~~
db.cpp: In function 'std::__cxx11::string configSingleGet(std::__cxx11::string)':
db.cpp:57:9: warning: unused variable 'rc' [-Wunused-variable]
int rc = sqlite3_exec(DB, sql.c_str(), configSingleGetCallback, (void*)"", NULL);
^~
db.cpp: In function 'int getLayoutCallback(void*, int, char**, char**)':
db.cpp:66:29: warning: unused parameter 'data' [-Wunused-parameter]
int getLayoutCallback(void* data, int argc, char** argv, char** azColName){
^~~~
db.cpp:66:65: warning: unused parameter 'azColName' [-Wunused-parameter]
int getLayoutCallback(void* data, int argc, char** argv, char** azColName){
^~~~~~~~~
db.cpp: In function 'std::__cxx11::string getLayout(int)':
db.cpp:81:9: warning: unused variable 'rc' [-Wunused-variable]
int rc = sqlite3_exec(DB, sql.c_str(), getLayoutCallback, (void*)"", NULL);
^~
db.cpp: In function 'int getLayoutDimCallback(void*, int, char**, char**)':
db.cpp:90:32: warning: unused parameter 'data' [-Wunused-parameter]
int getLayoutDimCallback(void* data, int argc, char** argv, char** azColName){
^~~~
db.cpp:90:68: warning: unused parameter 'azColName' [-Wunused-parameter]
int getLayoutDimCallback(void* data, int argc, char** argv, char** azColName){
^~~~~~~~~
db.cpp: In function 'int* getLayoutDim(int)':
db.cpp:105:9: warning: unused variable 'rc' [-Wunused-variable]
int rc = sqlite3_exec(DB, sql.c_str(), getLayoutDimCallback, (void*)"", NULL);
^~
db.cpp: In function 'int configUpdate(std::__cxx11::string, std::__cxx11::string)':
db.cpp:120:9: warning: unused variable 'rc' [-Wunused-variable]
int rc = sqlite3_exec(DB, sql.c_str(), emptyCallback, (void*)"", NULL);
^~
db.cpp: In function 'int langGetCallback(void*, int, char**, char**)':
db.cpp:16:12: internal compiler error: in pp_format, at pretty-print.c:630
static int langGetCallback(void* data, int argc, char** argv, char** azColName){
^~~~~~~~~~~~~~~
db.cpp:16:12: internal compiler error: Aborted
g++: internal compiler error: Aborted (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
In this moment I doubt the issue on the vector has any relation (although I appreciate that points), I tried to just remove all the calls to Vectors, Bidimensional arrays, etc; and still the constructor corrupts it (Now throwing a value of 0x8addd0 "�.")

Looks like you have zero sized vectors in your vector:
Now you could sort this with:
But this leads to another issue. Your internal type is an unmanged pointer
Room*. You may correctly delete all those rooms at some point (you don't show the code), but its probably not exeption safe.I would change the type and the way you add rooms to make everythign safe:
Then change your code to insert a room to: