multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.3k stars 412 forks source link

Fix #3495 OGG sound files can't be played as RAW data #3496

Closed FileEX closed 6 days ago

FileEX commented 1 week ago

Fixed #3495

The problem is that this condition returns true for raw data from .ogg files

https://github.com/multitheftauto/mtasa-blue/blob/f5b599c9f45777f924f7980cadb2d3cc6431d8b8/Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp#L168

This is because the IsValidFilePath function returns falsely true because strlen only reads the first 4 bytes which are the header of the .ogg files (0x4F 0x67 0x67 0x53) and then there is an empty byte \0 where strlen stops.

https://github.com/multitheftauto/mtasa-blue/blob/f5b599c9f45777f924f7980cadb2d3cc6431d8b8/Shared/mods/deathmatch/logic/Utils.cpp#L76-L93

I think this needs to be patched in the IsValidPath function, but at the moment it requires editing in many places, so let's make a temporary fix like this.

botder commented 1 week ago

Can't you overload IsValidFilePath for this?

FileEX commented 1 week ago

Done