mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-01 21:42:31 +01:00
nathanel23
f65599e216
Fix for memory corruption/crash related to rhash
This patch fixes issues with some calls to the rhash C library that cause subtle memory corruptions. There are two main issues that this patch addresses: 1) The library init function is called multiple times in various places within in the Util class. This is not necessary and may cause issues if the initialization is repeated simultaneously in multiple threads. Therefore the call was moved to the beginning of the main() function. 2) There is not enough space in the output buffers to store the terminating NUL character of the hex-formatted hashes. The print function from the rhash library writes a regular C string to the output buffer and expects enough space to include the end marker. Depending on the memory layout generated by the compiler, this results in one byte of the stack to be overwritten, which might lead to random issues that are hard to find. On AArch64 (ARM) with GCC 6.3 the call to the rhash_print() function happens to destroy the lower byte of the frame pointer and causes a crash due to an invalid free() operation some time after the Util::createXML function returned.
GOG Downloader
This repository contains the code of unofficial GOG downloader.
Dependencies
- libcurl >= 7.32.0
- liboauth
- librhash
- jsoncpp
- htmlcxx
- tinyxml2
- boost (regex, date-time, system, filesystem, program-options, iostreams)
- libcrypto if libcurl is built with OpenSSL
- zlib
Make dependencies
Debian/Ubuntu
# apt install build-essential libcurl4-openssl-dev libboost-regex-dev \
libjsoncpp-dev liboauth-dev librhash-dev libtinyxml2-dev libhtmlcxx-dev \
libboost-system-dev libboost-filesystem-dev libboost-program-options-dev \
libboost-date-time-dev libboost-iostreams-dev help2man cmake libssl-dev \
pkg-config zlib1g-dev
Build and install
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
$ make
# sudo make install
Use
man lgogdownloader
Links
Description
LGOGDownloader is unofficial downloader to GOG.com for Linux users. It uses the same API as the official GOG Galaxy.
Languages
C++
98.4%
CMake
1.6%