Skip to content

Commit 78564f9

Browse files
committed
Add uncompressed trade route loading bug
1 parent abef02a commit 78564f9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
- [Invulnerable Ship Artillery Slots](./bugs/invulnerable-ship-artillery-slots.md)
6666
- [Bath House Bribes Blunders](./bugs/bath-house-bribes-blunders.md)
6767
- [Multiplayer Locks](./bugs/multiplayer-locks.md)
68+
- [Uncompressed Trade Route Loading](./bugs/uncompressed-trade-route-loading.md)
6869
- [Patches](./patches.md)
6970
- [High Res](./patches/high-res.md)
7071
- [Increase Alderman "Found Settlement" Mission Limit](./patches/increase-alderman-found-settlement-limit.md)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Uncompressed Trade Route Loading
2+
3+
## Summary
4+
The `decompress_packed_trade_route` function at `0x006387E0` can handle uncompressed trade routes if the output length is negative.
5+
However, its caller fails to allocate the correct amount of memory, so the loading fails.
6+
7+
## Details
8+
Instead of calculating the absolute of the output size, the output size is `and`ed with `0x3fffffff`:
9+
![](uncompressed-trade-route-loading.png)
10+
11+
For negative output sizes the result is very big, so the allocation fails, and the trade route loading is aborted.
12+
13+
## Fix
14+
To fix this issue, the [correct absolute value](https://github.com/P3Modding/p3-lib/tree/master/mod-fix-uncompressed-trade-route-loading) must be calculated.
2.62 KB
Loading

0 commit comments

Comments
 (0)