Commit 3edfe194 added a `gamepad >= 0` lower-bound check to
GetGamepadAxisCount() and GetGamepadName(), but six sibling functions
were left with only the upper-bound check (`gamepad < MAX_GAMEPADS`).
A negative signed int passes that check and triggers out-of-bounds
access on CORE.Input.Gamepad.ready[gamepad] and related arrays (UB in C).
Apply the same `(gamepad >= 0) &&` guard added in 3edfe194 to:
- IsGamepadAvailable
- IsGamepadButtonPressed
- IsGamepadButtonDown
- IsGamepadButtonReleased
- IsGamepadButtonUp
- GetGamepadAxisMovement
* [rcore] Bounds-check gamepad index in GetGamepadAxisCount() and GetGamepadName()
Both public getters indexed CORE.Input.Gamepad.axisCount[gamepad] / .name[gamepad]
with an unvalidated gamepad argument -- an out-of-bounds read for gamepad < 0 or
gamepad >= MAX_GAMEPADS. Every sibling gamepad accessor (IsGamepadAvailable,
IsGamepadButton*, GetGamepadAxisMovement) already guards the index; add the same
check, returning a safe default (0 / NULL).
* Refactor GetGamepadName/GetGamepadAxisCount to single-return pattern
---------
Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
The MAX_TEXT_BUFFER_LENGTH guard present in TextReplace()/TextInsert() was
missing here, so the three strncpy() calls could write past the 1024-byte
static buffer for long inputs. Add the same length check before copying.
Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
The RL_MAX_MATRIX_STACK_SIZE check logged an error but did not return, so
RLGL.State.stack[stackCounter] = *currentMatrix still executed when the stack
was full -- writing one element past stack[RL_MAX_MATRIX_STACK_SIZE] and
corrupting the adjacent RLGL.State members (stackCounter, etc.). rlPopMatrix()
already guards the symmetric underflow case; add the missing early return.
Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
* Fixing ImageDrawLine to be more pixel accurate
Changes to ImageDrawLine() function.
. Added one pixel to the length of a line so it wont draw lines one pixel short.
. Changed rounding by adding 0.5 in 16 bit fixed point to 'j' in for-loop.
* Changed ImagDrawLine to be more acurate
* [rmodels] Fix glTF skinning when joints have non-joint parent nodes
Some glTF exporters (notably wow.export, but also various other DCC pipelines) place skin joints under intermediate non-joint transform nodes that carry part of the bind-pose offset. raylib's existing LoadBoneInfoGLTF and LoadModelAnimationsGLTF only inspected a joint's immediate parent and only sampled joint-local TRS, so any transform stored on an intermediate non-joint ancestor was silently dropped, producing exploded or stretched meshes at runtime.
Two surgical changes:
LoadBoneInfoGLTF: walk the parent chain past any non-joint ancestors when looking up parentIndex, instead of comparing only against node.parent. Joints whose direct parent is a non-joint were previously treated as skeleton roots.
LoadModelAnimationsGLTF: precompute a per-joint extOffset matrix that bakes in the static TRS contribution of any intermediate non-joint nodes between the joint and its nearest joint ancestor. Apply it to each frame's joint TRS before BuildPoseFromParentJoints so the per-frame world transforms match the bind-pose world transforms (LoadGLTF already used cgltf_node_transform_world for bindPose, so this aligns the two code paths).
The replaced root-only worldTransform adjustment is a strict subset of the new per-joint extOffset machinery, so it has been removed.
Spec-compliant files (the six skeletal-skinning .glb examples shipped with raylib) render bit-identically before and after; previously broken files (e.g. wow.export's babyoctopus.gltf) now match the reference rendering from f3d, the Khronos sample viewer, and three.js.
* Resolve review: NULL-check joint offset allocation, fail fast
[rmodels] Address review feedback on glTF joint offset handling
Resolve the open review points raised on PR #5876 for the per-joint
extOffset precompute in LoadModelAnimationsGLTF.
* NULL check: validate the extOffset RL_MALLOC result before use, which
was previously missing.
* Fail-fast handling: detect the allocation failure at its source and
abort animation loading (log a warning, free resources, return NULL)
instead of propagating a NULL pointer into the per-frame loop.
* Brace formatting: expand the collapsed one-line joint-match check
(if (...) { isJoint = true; break; }) into raylib's standard Allman
brace style.
* Readability: break the deeply nested MatrixMultiply(MatrixMultiply(...))
into named nodeScale/nodeRotation/nodeTranslation/nodeTransform locals,
mirroring the existing S/R/T composition later in the function.
* Spacing/line breaks: add blank lines within the precompute block to
match the surrounding code style.