Issue information

Issue ID
#5482
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Mar 21, 2012 14:16
Last Post
Hercules Elf Bot
Apr 18, 2012 9:36
Confirmation
N/A

Hercules Elf Bot - Mar 21, 2012 14:16

Originally posted by [b]solid2005[/b]
example

3002,ZOMBIE_MASTER,Zombie Master,Zombie Master,62,14211,0,7610,2826,1,824,1084,37,26,25,20,30,5,77,35,10,12,1,1,29,0x3695,175,2612,912,288,0,0,0,0,0,0,0,7071,4413,938,1500,958,1500,723,200,727,100,1260,1,2324,2,0,0,0,0,4274,1

when i over like this

3002,ZOMBIE_MASTER,Zombie Master,Zombie Master,62,14211,0,7610,2826,1,824,1084,37,26,25,20,30,5,77,35,10,12,1,1,29,0x3695,175,2612,912,288,0,0,0,0,0,0,0,7071,4413,938,1500,958,1500,723,200,727,100,1260,1,2324,2,0,0,0,0,4274,10,0,0,,0,0,0,0,


isn't message on server that i exceed the comma on mob_db2,txt.

Hercules Elf Bot - Mar 21, 2012 14:41

Originally posted by [b]Kenpachi[/b]
What exactly is the bug?
Why should the server tell you that you entered to much data? The server doesn't care about this.
All the data which is required is read and everything else is left untouched.

//EDIT:
xazax just mentioned that it would be a nice feature to inform the user about extra columns.
-> Moved to Core section.

This post has been edited by Kenpachi on Mar 21, 2012 14:46

Hercules Elf Bot - Mar 21, 2012 17:24

Originally posted by [b]Epoque[/b]
Processing columns is handled within sv_readdb() which receives a maximum number of columns to read from the database. As a result, sv_split() only processes however columns were specified as passed through sv_readdb(). I don't think there'd be a safe or reasonable method of splitting the columns without jeopardising some other components of the system.

[code]sv_readdb(db_path, filename[fi], ',', 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, 38+2*MAX_MVP_DROP+2*MAX_MOB_DROP, -1, &mob_readdb_sub);[/code]

As seen above, 38+2*MAX_MVP_DROP+2*MAX_MOB_DROP is the value used for maximum number of columns, sv_split() will only ever process this number of columns [i]unless [/i]we remove the safety check which might cause issues with other areas of rAthena (in terms of processing comma-seperated lines.)

Hercules Elf Bot - Mar 21, 2012 17:39

Originally posted by [b]xazax[/b]
Strange..

sv_readdb already have a check, still it did not warn. Maybe max column number that is given is invalid?

[code]
if( columns > maxcols )
{
ShowError("sv_readdb: Too many columns in line %d of \"%s\" (found %d, maximum is %d).\n", lines, path, columns, maxcols );
continue; // too many columns
}
[/code]

Anyways itemdb does not use sv_readdb, and it does not check for excess comas.

This post has been edited by xazax on Mar 21, 2012 17:42

Hercules Elf Bot - Mar 21, 2012 18:03

Originally posted by [b]Epoque[/b]
Yeah, it could certainly be implemented on the item database, but as far as monsters go the sv_split() limits the total number of columns by decrementing the maximum number of fields per iteration. It stops processing as soon as it hits the maximum number of columns, and as such it'll never reach the code you pasted above (unless there's some serious, serious problem.)

Hercules Elf Bot - Mar 21, 2012 18:13

Originally posted by [b]xazax[/b]
I just tested it. If I adjust the max size to the same as the min size, it will skip entries with too many columns, so sv_readdb does work well, just the function call is "broken". Extra columns are not used anyways, so I think it would be ok to lower the max column number to the same amount as min column number. Opinions?

Hercules Elf Bot - Mar 21, 2012 20:05

Originally posted by [b]Gepard[/b]
This is a typo from [rev=15531]. SVN Blame is your friend.

Hercules Elf Bot - Mar 23, 2012 12:22

Originally posted by [b]xazax[/b]
Fixed in [rev=15784].

This post has been edited by xazax on Mar 23, 2012 12:23