Skip to content

Conversation

@gemt
Copy link
Owner

@gemt gemt commented Apr 19, 2017

I found, I believe, a very scary bug.

https://github.com/elysium-project/server/blob/development/src/shared/ByteBuffer.h#L402

On a call to SendMeleeAttackStop() from map update, I am assuming because I was targetting a temprary creature spawn that despawned as as it happened (i have reproduced this multiple times btw), buffer.wpos() returned 8, while buffer.size() is 0. Thus, when buffer.contents() try to run return &_storage[0]; a crash happens.(edited)

I attempted to replace buffer.wpos() with buffer.size(), and I am no longer able to reproduce the bug, but this is really old code from what I can find, so it strikes me as odd that i's always been buffer.wpos(), and noone has noticed or done anything about it
is anyone more familiar with the ByteBuffer class able to see if .size() is a valid replacement for .wpos()? It seems much safer to me. I assume the idea is that wpos should always be safe to use, but wpos can be changed a ton of places so its hard to imagine it can't fail (as it did for me now)

@gemt
Copy link
Owner Author

gemt commented Apr 19, 2017

To reproduce the bug do the following:

go to bug trio boss, .die them, rigth click one of the bugs that spawn from yauj so that you attack-animation them, and wait for them to despawn
when they despawn it crashes
takes ~4sec
you need to be in gm while doing it

@gemt
Copy link
Owner Author

gemt commented Apr 19, 2017

This was not reproducable when built with GCC and ran on linux.

It does happen when build with msvc14 on windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants