[Mesa-dev] [PATCH 10/15] mesa: Implement KHR_debug ObjectLabel functions
Timothy Arceri
t_arceri at yahoo.com.au
Wed Sep 4 18:17:39 PDT 2013
>>> + /* explicit length */
>>> + *labelPtr = (char *) malloc(length);
>>> + if (*labelPtr) {
>>> + memcpy(*labelPtr, label, length);
>>> + }
>>> + }
>>> + else {
>>> + /* null-terminated string */
>>> + int len = strlen(label);
>>> + if (len >= MAX_LABEL_LENGTH) {
>>The reason MAX_LABEL_LENGTH exists is so that you can have a fixed-size
>>array in your structure (so you don't have to malloc a buffer. Either
>>make a fixed size buffer, or make MAX_LABEL_LENGTH be the maximum size
>>representable in a GLsizei (and eliminate this check).
>Ok makes sense. However the check is still valid its in the spec. We shouldn't just truncate the string I know for sure that the AMD driver does the same thing. I >have posted extensive tests for the objectlabel code on the piglit list.
Ignore my comment I see now you are talking about the malloc check I thought you meant the MAX_LABEL_LENGTH test in the last line.
More information about the mesa-dev
mailing list