Possible bug in StringBuffer::SetGrowSize — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Possible bug in StringBuffer::SetGrowSize

8bit8bit Posts: 94 Oculus Start Member
edited November 2015 in Oculus Go Development
Just looking through the SDK I found this possible error.
I could be wrong but I believe there is a missing +1.

LibOVRKernel/Src/Kernel/OVR_String.cpp
void StringBuffer::SetGrowSize(size_t growSize) 
{ 
    if (growSize <= 16)
        GrowSize = 16;
    else
    {
        uint8_t bits = Alg::UpperBit(uint32_t(growSize-1));
		size_t size = (size_t)1 << bits;
        GrowSize = size == growSize ? growSize : size;
    }
}

Shouldn't this be
void StringBuffer::SetGrowSize(size_t growSize) 
{ 
    if (growSize <= 16)
        GrowSize = 16;
    else
    {
        uint8_t bits = Alg::UpperBit(uint32_t(growSize-1)) + 1;
		size_t size = (size_t)1 << bits;
        GrowSize = size == growSize ? growSize : size;
    }
}
Anyway, just putting this out there in case people are running into seg faults with strings.
-- Assuming I am reading this right, of course --
Sign In or Register to comment.