Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator/testsuite issues #36

Closed
m-hilgendorf opened this issue Jun 24, 2019 · 1 comment
Closed

Validator/testsuite issues #36

m-hilgendorf opened this issue Jun 24, 2019 · 1 comment

Comments

@m-hilgendorf
Copy link

The following code can cause stack overflows on Linux with both clang/gcc when printing to stdout from inside a plugin (for debugging purposes)

std::u16string printf (const char8* format, ...)
{
	using VST3::StringConvert::convert;

	char8 string[1024 * 4]; // <<<<<< offending line

	va_list marker;
	va_start (marker, format);

	vsnprintf (string, kPrintfBufferSize, format, marker);
	return convert (string).data ();
}

Fix:

std::u16string printf (const char8* format, ...)
{
	using VST3::StringConvert::convert;

	std::string string;
	string.reserve(1024 * 4);

	va_list marker;
	va_start (marker, format);

	vsnprintf (&string[0], kPrintfBufferSize, format, marker);
	return convert (string).data ();
}

In /testsuite/busconsistency

    randIndex = rand () % (numBusses);

this generates a number between 0 and RAND_MAX when numBusses == 1. I get that there should be at least one event and one audio bus so this shouldn't be an issue, but when testing other issues it came up.

@m-hilgendorf
Copy link
Author

Closing this because I realized it was a problem in my own code, the stack overflow was a false positive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant