Skip to content

Conversation

@ryanhuang
Copy link

fix cursor.cc reading an empty string error when compile without "-o2…

void
cursor::string(std::string &out)
{
        size_t size;
        const char *p = this->cstr(&size);
        out.resize(size);
	if (size > 0)
	{
        	memmove(&out.front(), p, size);
	}
}

without -o2, "memmove(&out.front(), p, 0) will raise an assert error in gcc8.1.4 centos 8.5(4.18.0-348.2.1.el8_5.x86_64)"

Woazboat added a commit to Woazboat/sweb that referenced this pull request Mar 25, 2023
… string

Bug found in SWEB by https://github.com/Ferdi265

Open pull request on the upstream project that's been ignored so
far... aclements/libelfin#63
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

Successfully merging this pull request may close these issues.

1 participant