Skip to content

Tiger SVG test case fails sporadically with different output sizes #10

@2swap

Description

@2swap

The case as defined with 1024x768 output passes for me, but changing the dimensions to anything that is not a scaling of that same aspect ratio yields varied memory errors. I have so far seen double free or corruption (out) and free(): invalid pointer.
In the test, I modified the code as follows:

		MovieReader reader("svg_image", width, height);
		{
			MovieWriter writer("svg_image2", width, height);
			{
				vector<uint8_t> pixels;	
				while (1)
				{
					if (!reader.getFrame(pixels))
						break;
				
					writer.addFrame(&pixels[0]);
				}
			cout << "1" << endl;
			}
			cout << "2" << endl;
		}
			cout << "3" << endl;
	}

and furthermore I added logging to the deconstructor of MovieWriter, suspecting that the error was in there:

MovieWriter::~MovieWriter()
{	
			cout << "a" << endl;
	// Writing the delayed frames:
[...]
	cairo_surface_destroy(cairo_surface);
			cout << "z" << endl;
}

The result that I see is:

Writing frame 35 (size = 28)
Writing frame 36 (size = 34)
Writing frame 37 (size = 28)
Writing frame 38 (size = 28)
1
2
a
Writing frame 39 (size = 28)
Writing frame 40 (size = 475)
Writing frame 41 (size = 27)
Writing frame 42 (size = 27)
Writing frame 43 (size = 27)
Writing frame 44 (size = 27)
Writing frame 45 (size = 27)
Writing frame 46 (size = 27)
Writing frame 47 (size = 27)
Writing frame 48 (size = 237)
Writing frame 49 (size = 27)
Writing frame 50 (size = 164)
Writing frame 51 (size = 27)
Writing frame 52 (size = 27)
Writing frame 53 (size = 27)
Writing frame 54 (size = 27)
Writing frame 55 (size = 27)
Writing frame 56 (size = 141)
Writing frame 57 (size = 27)
Writing frame 58 (size = 27)
Writing frame 59 (size = 27)
Writing frame 60 (size = 138)
Writing frame 61 (size = 27)
Writing frame 62 (size = 27)
z
free(): invalid pointer

This is confusing to me: it seems like the moviewriter deconstructor completes as expected, since "z" is printed, but for whatever reason when that local scope defined by the brackets is closed, something else is causing this memory error (since "3" is not printed.)

Wondering if you have any idea. I am using this for a project and I ran into the same error, and I would like to avoid needing to check SVG size every time to match its aspect ratio, assuming that is in fact the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions