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

REVIEWED small issue #3777

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/rtext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1471,13 +1471,14 @@
text++;
}

for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
int i = 0;
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');

if (text[i++] != '.') value *= sign;
else
{
float divisor = 10.0f;
for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++)
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
{
value += ((float)(text[i] - '0'))/divisor;
divisor = divisor*10.0f;
Expand Down Expand Up @@ -2371,7 +2372,7 @@

if (pixelX >= charGlyphInfo->image.width) break;

if ((byte & (8 >> bitX)) > 0) ((unsigned char*)charGlyphInfo->image.data)[(pixelY * charGlyphInfo->image.width) + pixelX] = 255;

Check warning

Code scanning / CodeQL

Sign check of bitwise operation Warning

Potentially unsafe sign check of a bitwise operation.
}
}
}
Expand Down Expand Up @@ -2422,7 +2423,7 @@
charGlyphInfo->offsetY = fontBBh - (charBBh + charBByoff0 + fontBByoff0 + fontAscent);
charGlyphInfo->advanceX = charDWidthX;

charGlyphInfo->image.data = RL_CALLOC(charBBw * charBBh, 1);

Check failure

Code scanning / CodeQL

Overflow in uncontrolled allocation size High

This allocation size is derived from
user input (string read by fread)
and might overflow.
charGlyphInfo->image.width = charBBw;
charGlyphInfo->image.height = charBBh;
charGlyphInfo->image.mipmaps = 1;
Expand Down
Loading