View Issue Details

IDProjectCategoryView StatusLast Update
0009106Multi Theft Auto : San AndreasScriptingpublic2016-01-28 18:25
ReporterCheez Assigned ToJusonex  
Status resolvedResolutionfixed 
Target Version1.5.2Fixed in Version1.5.2 
Summary0009106: Supplying negative value to fileRead will stop execution of script without displaying an error

Title describes the issue.

Steps To Reproduce

local file = fileOpen("somefile.txt");


fileClose(file); -- i won't be executed

outputDebugString("i won't be displayed");

TagsNo tags attached.



2016-01-07 17:46

updater   ~~0024299

Last edited: 2016-01-07 17:53

Where did you run the script - server or client side?

Testing server side with the following script:
outputConsole("Here we go.")
local fileh=fileOpen("matrix32.png")
outputConsole("I am at position "..tostring(fileGetPos(fileh)))
outputConsole("I'm going home now")

gives the following results:
MTA:SA Server v1.5.1-release-7607 (linux 32bit):
restart: Resource restarting...
Here we go.
I am at position 0
I'm going home now

MTA:SA Server v1.6-unstable-7730 (linux x64):
restart: Resource restarting...
Here we go.
I am at position 0
I'm going home now

additionally, on the 1.6 server console:
[2016-01-07 17:37:36] WARNING: theluafile.lua:3: Bad argument @ 'fileRead' [Expected positive value, got negative]

For me, it's not reproduceable server side.


2016-01-07 17:59

viewer   ~~0024300

I'm sorry. I should have mentioned that this happens client-side. I've tested it again and it seems that with -1 everything works just fine, but with -2 or any other value it happens just as I described above.


2016-01-07 18:14

updater   ~~0024301

Tested the same way with client v1.5.1-release-7740 with the same testing code and also with -8 and -10e1000:

For me, it's NOT reproduceable.


2016-01-07 18:27

administrator   ~~0024302

Cheez, please test with


2016-01-07 18:55

viewer   ~~0024303

I've updated to 7742 and I'm still having the issue.
Please watch this video where I reproduce it:


2016-01-07 19:39

updater   ~~0024304

I did a fileOpen with an existing file. With the steps from the video, I can reproduce it. At your video, you do a fileCreate an then a fileRead at the just created 0 byte file :)

Also: trying that server side, CRASHES THE SERVER !


2016-01-11 17:34

administrator   ~~0024320

This has already been fixed in 1.6 by:

Not sure if it's ready for merging to 1.5 yet, due to possible issues with existing scripts.

Issue History

Date Modified Username Field Change