libelfin icon indicating copy to clipboard operation
libelfin copied to clipboard

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

Open ryanhuang opened this issue 4 years ago • 0 comments

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)"

ryanhuang avatar Dec 22 '21 09:12 ryanhuang