Heap corrupted with ofGLRenderer

Open
#6,186 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Reproduce the issue on Windows using gflags full page heap and the provided ofApp example with a dummy h.png. Start by tracing ofGLRenderer::draw, especially the ofFbo texture alpha-mask and subsequent image draw; compare behavior with settings.setGLVersion(3, 2). Done means the reproducer no longer corrupts the heap or crashes under page heap verification.

Written by the indexing model from the issue text.

Description

The ofGLRenderer seems to corrupt the heap in some cases.

It gets reproducable if some heap fail-safing software is used. I was able to reproduce it with gflags on Windows. Use this to enable full page heap verification for the built executable, in my case crash_debug.exe

gflags.exe /p /enable crash_debug.exe /full

Here is the code that reproduces this if page heap is activated. Just use a dummy file for h.png

int main()
{
	ofGLWindowSettings settings;
//uncommenting the following line makes the crash go away as ofGLProgrammableRenderer is used
//	settings.setGLVersion(3, 2);
	ofCreateWindow(settings);
	ofRunApp(new ofApp());
}

void ofApp::setup()
{

}

void ofApp::update()
{
}

void ofApp::draw()
{
	ofFbo container;
	ofImage maskRight;
	ofImage header;

	maskRight.load("h.png");

	container.allocate(100, 100, GL_RGBA);
	container.getTexture().setAlphaMask(maskRight.getTexture());
	container.draw(0, 0);

	header.load("h.png");
	header.draw(0, 0);
}

This crashes in ofGLRenderer::draw every time now, so there really seems to be something trashing the heap. Without the enabled gflags page heap it will crash randomly after a few minutes or days.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openframeworks/openFrameworks

All issues in openframeworks/openFrameworks

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.