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

script error in native 000000008f57a89d: arg[1]: buffer too small (8 < 24) (GetCamMatrix) #3009

Closed
ImBaphomettt opened this issue Dec 16, 2024 · 23 comments

Comments

@ImBaphomettt
Copy link

What happened?

It seems that since the latest update, the native function GetCamMatrix is experiencing some issues. Could this be due to improper usage on my part following recent changes, or is it simply an external issue? It was working perfectly fine just yesterday.

image

Here is code to reproduce the issue.

    local cam = CreateCam('DEFAULT_SCRIPTED_CAMERA')
    SetCamCoord(cam, GetEntityCoords(PlayerPedId()))
    SetCamActive(cam, true)
    RenderScriptCams(true, false)
    local rightVector, forwardVector, upVector, position = GetCamMatrix(cam)
    print(rightVector, forwardVector, upVector, position)

Expected result

Native working again.

Reproduction steps

  1. Execute the code client-side and get exeception

Importancy

Crash

Area(s)

FiveM

Specific version(s)

3258 (canary)

Additional information

No response

@ImBaphomettt ImBaphomettt added bug triage Needs a preliminary assessment to determine the urgency and required action labels Dec 16, 2024
@github-actions github-actions bot added the crash label Dec 16, 2024
@ImBaphomettt
Copy link
Author

It seems that the following native is also broken: GetShapeTestResult.
image

@ImBaphomettt ImBaphomettt changed the title script error in native 000000008f57a89d: arg[1]: buffer too small (8 < 24) script error in native 000000008f57a89d: arg[1]: buffer too small (8 < 24) (GetCamMatrix) Dec 16, 2024
@d22tny
Copy link

d22tny commented Dec 16, 2024

function Inventory:getVehicleInDirection(coordFrom, coordTo)
	local rayHandle = StartExpensiveSynchronousShapeTestLosProbe(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, PlayerPedId(), 0)
	local _, _, _, _, vehicle = GetShapeTestResult(rayHandle)

	return vehicle
end

-->
image

function FPTOffroad:getNearestRoadDistance()
    local coords = GetEntityCoords(PlayerPedId())
    local ret, srcNode, targetNode, laneCountForward, laneCountBackward, width = GetClosestRoad(coords.x, coords.y, coords.z, 1.0, 0, true)
    local dist1 = #(srcNode - coords)
    local dist2 = #(targetNode - coords)
    return math.min(dist1, dist2)
end

-->
image

Also GetModelDimensions also errors out:

image

So this seems to be happening on natives that return more than 1 thing.

I think @iridium-cfx could assist in this issue.

@Mathu-lmn
Copy link
Contributor

Hey, I believe iridium and the cfx are aware and working on a fix !
This issue seems to happen when the native's raw definition contains a Vector3* (so most natives returning a vector3 value)

@TheRealBablo
Copy link

a temporary fix change branch in your fivem client

@Mathu-lmn
Copy link
Contributor

Yeah, don't go to canary if you're not testing new features ! Tho I hope they fix this issue ASAP as we all know that many simple players are on the canary release channel !

@iridium-cfx
Copy link
Contributor

iridium-cfx commented Dec 16, 2024

I'm currently unable to reproduce the issue locally, running on the latest canary.

Does this still happen if you just run the command on a vanilla server?

@d22tny
Copy link

d22tny commented Dec 16, 2024

@iridium-cfx I'll do the tests right now using the GetClosestRoad native and i'll report back.

@d22tny
Copy link

d22tny commented Dec 16, 2024

@iridium-cfx You're right. It doens't happen right away.
Vanilla -> Returns as expected.
All scripts on -> Returns as expected until i spawn a car through my garage, i'll debug further to see what from the spawning function breaks it.

@Mathu-lmn
Copy link
Contributor

Most likely one of these :
GetCamMatrix
GetShapeTestResult
GetModelDimensions
GetEntityMatrix
GetClosestFirePos
GetSafeCoordForPed

@coalaura
Copy link

I had the same error pop up on the latest build, beta seems fine. Not sure if its related but i've also had the issue pop up where GetAspectRatio(false) appears to return a vector on the latest build but not beta/release

@Mathu-lmn
Copy link
Contributor

Hmm that's weird I don't see it returning any vector here
image

@Exyztence
Copy link

I have exactly the same issue
image

@Xergxes7
Copy link

Xergxes7 commented Dec 16, 2024

Getting this issue with following code from ps-inventory:
local dimensionMin, dimensionMax = GetModelDimensions(GetEntityModel(vehicle))

image

Vehicle variable declared through a QBCore function:
local vehicle = QBCore.Functions.GetClosestVehicle()

function QBCore.Functions.GetClosestVehicle(coords)
    local ped = PlayerPedId()
    local vehicles = GetGamePool('CVehicle')
    local closestDistance = -1
    local closestVehicle = -1
    if coords then
        coords = type(coords) == 'table' and vec3(coords.x, coords.y, coords.z) or coords
    else
        coords = GetEntityCoords(ped)
    end
    for i = 1, #vehicles, 1 do
        local vehicleCoords = GetEntityCoords(vehicles[i])
        local distance = #(vehicleCoords - coords)

        if closestDistance == -1 or closestDistance > distance then
            closestVehicle = vehicles[i]
            closestDistance = distance
        end
    end
    return closestVehicle, closestDistance
end

@iridium-cfx
Copy link
Contributor

Ah, I've figured out what the issue is, will hopefully push a fix soon 😅

@d22tny
Copy link

d22tny commented Dec 16, 2024

Glad to hear that, i didn't manage to error it on a vanilla server whatsoever :))

@ImBaphomettt
Copy link
Author

Ah, I've figured out what the issue is, will hopefully push a fix soon 😅

Perfect! I'll let you close the issue when all is well then ! ❤️

@iridium-cfx
Copy link
Contributor

The fix is merged, let me know if you are still having issues. If not, I'll close the issue tomorrow

@Psycho66626
Copy link

i'm sorry sir, but still the same 😭😭😭
image

The fix is merged, let me know if you are still having issues. If not, I'll close the issue tomorrow

@Mathu-lmn
Copy link
Contributor

This is not related at all ???

@Psycho66626
Copy link

image
and we have faced this debug with all scripts before this print in queue, probably it's 2 in 1

@Mathu-lmn
Copy link
Contributor

What are you even saying at this point... I can't understand you but the issue on your screenshot was fixed recently, please restart your game to make sure that you're under the correct version and tell us if it happens again

@Psycho66626
Copy link

the same sir Couldn't load resource sessionmanager: Failed to open packfile: ReadBulk of header failed:

@Mathu-lmn
Copy link
Contributor

Again, this is not related to this issue so please join the discord to get support on this issue

@github-actions github-actions bot removed the triage Needs a preliminary assessment to determine the urgency and required action label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants