thpatch / thtk

Touhou Toolkit
https://thtk.thpatch.net/
Other
307 stars 43 forks source link

thdat: fix wrong thtk_io_map() usage in th02_read() and th02_write() #119

Open FOTMarut opened 4 months ago

FOTMarut commented 4 months ago

thtk_io_map() creates a read-only memory mapping, but both th02_read() and th02_write() perform writes to the data buffer. This immediately segfaults (well actually it doesn't, because mmap always fails, but that's another story). This commit fixes it so thtk_io_pread() is used directly instead.