View Issue Details

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

Title describes the issue.

Steps To Reproduce

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

fileRead(file,-1);

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

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

TagsNo tags attached.

Activities

StifflersMom

2016-01-07 17:46

updater   ~~0024299

Last edited: 2016-01-07 17:53

View 2 revisions

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")
fileRead(fileh,-1)
outputConsole("I am at position "..tostring(fileGetPos(fileh)))
fileClose(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.

Cheez

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.

StifflersMom

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.

qaisjp

2016-01-07 18:27

administrator   ~~0024302

Cheez, please test with https://nightly.mtasa.com/mtasa-1.5.1-rc-7742-20160102.exe

Cheez

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: https://www.youtube.com/watch?v=G1pjIBZ8CNg

StifflersMom

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 !

ccw

2016-01-11 17:34

administrator   ~~0024320

This has already been fixed in 1.6 by:
https://github.com/multitheftauto/mtasa-blue/commit/60ae4c338c81d7f083e734603a47c883044acd9a

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