Bug#922485: brainparty: Minigame "Symbolic Logic": Premises are empty or contain garbage.
Johann Suhter
jo.suhter at plidum.de
Sat Feb 16 21:10:17 GMT 2019
Package: brainparty
Version: 0.61+dfsg-3+b1
Severity: normal
Tags: patch
Dear Maintainer,
the minigame "Symbolic Logic" whithin brainparty cannot be played
because the premises are not shown.
Steps to reproduce:
Start the program and select the game "Symbolic Logic".
I can select it by clicking on
- "PLAY!"
- "PRACTISE"
- 3 times "MORE" for searching the "Symbolic Logic" minigame
- the item in the middle which has an icon with a text like "All sales
assist / wrestle crocodi / Catherine ...".
- Then a description of the game appears, and I click anywhere on
this description.
- Now the game starts.
Expected behaviour:
I expect 3 sentences: Two premises and a conclusion.
Observed behaviour:
The conclusion is shown.
The two premises are completely missing, only two full stops appear.
Sometimes, I see some garbage characters instead.
Patch:
I have debugged the program a bit and I think the responsible function
is "const char* FlattenPremise(...)" which returns a pointer to a
temporary string object which is undefined behaviour.
I would suggest the following patch. The patch refers to
brainparty_0.61+dfsg-3 (I am on Debian stable), but when I browse the
sources on https://salsa.debian.org/games-team/brainparty the bug
still seems to exist.
--- a/symboliclogic.cpp Sat Feb 16 21:39:30 2019 +0100
+++ b/symboliclogic.cpp Sat Feb 16 21:49:13 2019 +0100
@@ -116,7 +116,7 @@
}
}
-const char* BPMiniGame_SymbolicLogic::FlattenPremise(BPMiniGame_SymbolicLogic_Premise* premise) {
+string BPMiniGame_SymbolicLogic::FlattenPremise(BPMiniGame_SymbolicLogic_Premise* premise) {
ostringstream result;
switch (premise->Type) {
@@ -150,7 +150,7 @@
break;
}
- return result.str().c_str();
+ return result.str();
}
void BPMiniGame_SymbolicLogic::Tick() {
--- a/symboliclogic.h Sat Feb 16 21:39:30 2019 +0100
+++ b/symboliclogic.h Sat Feb 16 21:49:13 2019 +0100
@@ -67,7 +67,7 @@
void Start();
int GetWeight();
void Render();
- const char* FlattenPremise(BPMiniGame_SymbolicLogic_Premise* premise);
+ string FlattenPremise(BPMiniGame_SymbolicLogic_Premise* premise);
void Tick();
void OnMouseDown();
Thank you.
-- System Information:
Debian Release: 9.8
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-8-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages brainparty depends on:
ii brainparty-data 0.61+dfsg-3
ii fonts-freefont-ttf 20120503-6
ii libc6 2.24-11+deb9u4
ii libgcc1 1:6.3.0-18+deb9u1
ii libgl1-mesa-glx [libgl1] 13.0.6-1+b2
ii libglu1-mesa [libglu1] 9.0.0-2.1
ii libsdl-gfx1.2-5 2.0.25-5
ii libsdl-image1.2 1.2.12-5+deb9u1
ii libsdl-mixer1.2 1.2.12-11+b3
ii libsdl-ttf2.0-0 2.0.11-3+b1
ii libsdl1.2debian 1.2.15+dfsg1-4
ii libstdc++6 6.3.0-18+deb9u1
brainparty recommends no packages.
brainparty suggests no packages.
-- no debconf information
More information about the Pkg-games-devel
mailing list