diff --git a/src/rlgl.h b/src/rlgl.h index bbf52db25..7a0d7f862 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -2998,7 +2998,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipWidth = width; int mipHeight = height; int mipOffset = 0; // Mipmap data offset, only used for tracelog - + // NOTE: Added pointer math separately from function to avoid UBSAN complaining unsigned char *dataPtr = (unsigned char *)data; @@ -3403,7 +3403,7 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format) // Attach our texture to FBO glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id, 0); - + // We read data as RGBA because FBO texture is configured as RGBA, despite binding another texture format pixels = (unsigned char *)RL_MALLOC(rlGetPixelDataSize(width, height, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)); glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); @@ -3697,7 +3697,7 @@ void rlDrawVertexArrayElements(int offset, int count, const void *buffer) // NOTE: Added pointer math separately from function to avoid UBSAN complaining unsigned short *bufferPtr = (unsigned short *)buffer; if (offset > 0) bufferPtr += offset; - + glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)bufferPtr); } @@ -3716,7 +3716,7 @@ void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffe // NOTE: Added pointer math separately from function to avoid UBSAN complaining unsigned short *bufferPtr = (unsigned short *)buffer; if (offset > 0) bufferPtr += offset; - + glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)bufferPtr, instances); #endif } diff --git a/src/rtextures.c b/src/rtextures.c index 8dc49fac5..fa8d91ea4 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -325,7 +325,7 @@ Image LoadImageSvg(const char *fileNameOrString, int width, int height) #if defined(SUPPORT_FILEFORMAT_SVG) bool isSvgStringValid = false; - + // Validate fileName or string if (fileNameOrString != NULL) { @@ -355,7 +355,7 @@ Image LoadImageSvg(const char *fileNameOrString, int width, int height) if (isSvgStringValid) { struct NSVGimage *svgImage = nsvgParse(fileData, "px", 96.0f); - + unsigned char *img = RL_MALLOC(width*height*4); // Calculate scales for both the width and the height