Lehks / NostraUtils

A Utility Library for the Nostra Game Engine.
MIT License
6 stars 0 forks source link

String throws runtime error #71

Open LeslieM98 opened 6 years ago

LeslieM98 commented 6 years ago

When executing some inserts and replaces some runtime exception gets thrown: HEAP[Test.exe]: Heap block at 00B527F0 modified at 00B52888 past requested size of 8f

look at this commit: 2f063dfb52b34ec294d93e9cd5251f84b1308752 (Hint: this commit is inside NostraEngine) Run this main method:

#include <stdlib.h>
#include <iostream>
#include "nostraengine/core/StdIncludes.hpp"
#include "nostrautils/NostraUtils.hpp"
#include "nostraengine/material_system/PreProcessor.hpp"

using namespace NOE;
using namespace std;
using namespace NOT;
using namespace NOU;

int main()
{
    NOU::NOU_FILE_MNGT::File f("***"); //Change this File destination to a file containing the written lines below
    PreProcessor pp(f);
    pp.start();
    system("pause");
}

The code will jump in a method called PreProcessor::include() and then around line 253 somewhere in the insert method this error gets thrown. Containments of the pointed File:

someTestShitstuff asdf
#include "file3"
someTestShistSuff asdf
#include "file1"

file1 containments:

#include "file2";
#include "file3";
file1;
#define asdf 12
void someFunc(asdf, adf){
        return 12;
}
void anotherFunc(asdf, adf)
{
        return 420;
}
----------;

file3 containments:

file3;
----------;

(Make sure it uses the /n lineendings since the /r/n line endings are not tested yet)

Also make sure in the PreProcessor.cpp line 16 is set to the following to disable some debugprints since it could lead to undefined behaviour on other machines than mine.

#define DEBUG_STUFF_
LeslieM98 commented 6 years ago

Telling from the callstack some error in the resize methode occured. It occures in the alignedFree method in the Utils.cpp

According to the debugger everything went fine till the reallocateData() - free(m_data) method in the vector.