Giter Club home page Giter Club logo

bastet's People

Contributors

degasus avatar fph avatar fusl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bastet's Issues

[vulnerability report]A Format string vulnerability

There is something wrong with this line of code
`void Ui::MessageDialog(const std::string &message){
RedrawStatic();

Dot d=BoundingRect(message);

BorderedWindow w(d.y,d.x);
wattrset((WINDOW *)w,COLOR_PAIR(20));
mvwprintw(w,0,0,message.c_str());//format string vulnerability,when you input your name such as 123%253c%11$n
w.RedrawBorder();
wrefresh(w);
PrepareUiGetch();
int ch;
do{
  ch=getch();
}
while(ch!=' ' && ch!=13); //13=return key!=KEY_ENTER, it seems

}`

mvwprintw is not safe。
You should restrict user input to prevent format string vulnerability.

Build fails with libc++

Building bastet 0.43 fails on OS X 10.9 Mavericks. With this version of OS X, Apple has switched the default C++ library from libstdc++ to libc++, which does not include experimental pre-standardization C++11 features such as the ones you're using in your code; it only supports the final C++11 standard.

--->  Building bastet
DEBUG: Executing org.macports.build (bastet)
DEBUG: Environment: 
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/.CC_PRINT_OPTIONS'
CPATH='/opt/local/include'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='10.9'
DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43" && /usr/bin/make -w all CXX=/usr/bin/clang++ CXXFLAGS="-Os -arch x86_64" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64" PREFIX=/opt/local'
DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43" && /usr/bin/make -w all CXX=/usr/bin/clang++ CXXFLAGS="-Os -arch x86_64" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64" PREFIX=/opt/local 
make: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
Makefile:14: depend: No such file or directory
/usr/bin/clang++ -MM Ui.cpp main.cpp Block.cpp Well.cpp BlockPosition.cpp Config.cpp BlockChooser.cpp BastetBlockChooser.cpp > depend
In file included from Ui.cpp:22:
./BastetBlockChooser.hpp:26:10: fatal error: 'tr1/unordered_set' file not found
#include <tr1/unordered_set>
         ^
1 error generated.
In file included from main.cpp:21:
./BastetBlockChooser.hpp:26:10: fatal error: 'tr1/unordered_set' file not found
#include <tr1/unordered_set>
         ^
1 error generated.
In file included from BastetBlockChooser.cpp:19:
./BastetBlockChooser.hpp:26:10: fatal error: 'tr1/unordered_set' file not found
#include <tr1/unordered_set>
         ^
1 error generated.
make: *** [depend] Error 1
make: Leaving directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'

If you do not have access to a Mac, you should be able to reproduce this on any other system that has libc++ available.

error: friend declaration specifying a default argument must be a definition

Hello, bastet 0.43.1 fails to build for me on OS X:

/usr/bin/clang++ -Os -arch x86_64 -DNDEBUG -Wall   -c -o Ui.o Ui.cpp
In file included from Ui.cpp:19:
In file included from ./Ui.hpp:22:
./Well.hpp:69:17: error: friend declaration specifying a default argument must be a definition
    friend long Evaluate(const Well *w, int extralines=0); //for BastetBlockChooser
                ^
1 error generated.

New Minor Release

Hi - any chance we could get a new minor release with the latest changes (especially with the fix of #6 included). I'm currently working on a package for Void and would rather use an official release than having it patched. Thanks.

fatal error: boost/foreach.hpp: No such file or directory

Missing directory and file:

g++ -MM Ui.cpp Block.cpp Well.cpp BlockPosition.cpp Config.cpp BlockChooser.cpp BastetBlockChooser.cpp main.cpp Test.cpp> depend BlockPosition.cpp:23:10: fatal error: boost/foreach.hpp: No such file or directory 23 | #include "boost/foreach.hpp" | ^~~~~~~~~~~~~~~~~~~ compilation terminated. Makefile:20: depend: No such file or directory make: *** [Makefile:18: depend] Error 1

Config file

I'm sorry but I cannot find how to edit the config file. The manpage mentions a .bastetrc file but I have no syntax reference and would like to know if I can permanently configure my own keybindings.

Change default keys forever

Is there a way to customize keys and then retain this preference?

If not, can this be added? A simple implementation idea would just be to not regenerate ~/.bastetrc if there is already one.

Thanks!

Follow XDG Base Directory Specifications

Currently, Bastet automatically generates the .bastetrc and .bastetscores files in $HOME. This pollutes the home directory, and doesn't follow the XDG Base Directory Specs.

The specs state that program configuration should be localised to a subdirectory of $XDG_CONFIG_HOME, which defaults to $HOME/.config. In Bastet's case, I think it would make sense to move $HOME/.bastetrc to $XDG_CONFIG_HOME/bastet/bastetrc.

Similarly, user-specific data should be stored in a subdirectory of $XDG_DATA_HOME, which defaults to $HOME/.local/share. In Bastet's case, I think it would make sense to move $HOME/.bastetscores to $XDG_CONFIG_HOME/bastet/scores or something similar.

Fails to build with Boost >= 1.65

With recent compiler (latest clang, e.g. from Xcode 9 on macOS) and latest boost (1.65), the compilation fails because:

./BastetBlockChooser.hpp:26:10: fatal error: 'boost/tr1/tr1/unordered_set' file not found
#include <boost/tr1/tr1/unordered_set>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is available as system header under the name #include <unordered_set>

Segfault when trying to start new game

I've just installed bastet via Homebrew on macOS (brew install bastet) and whenever I want to start a new game (normal or harder version) the game crashes with a segmentation fault (Segmentation fault: 11).

bastet: 0.43.2
boost: 1.68.0
macOS: 10.13.6

Edit: I've attached a core dump to ease debugging: bastet_2018-12-18-160559.crash

Build fails if boost is only installed multi-threaded

bastet 0.43 assumes the single-threaded library boost_program_options is available, but it is possible to compile boost with only multi-threaded support, in which case only the library boost_program_options-mt will be available; this is the case in MacPorts for example, resulting in e.g. this build failure on Mac OS X 10.5:

--->  Building bastet
DEBUG: Executing org.macports.build (bastet)
DEBUG: Environment: CPATH='/opt/local/include' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/.CC_PRINT_OPTIONS' LIBRARY_PATH='/opt/local/lib' CC_PRINT_OPTIONS='YES' MACOSX_DEPLOYMENT_TARGET='10.5'
DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43" && /usr/bin/make -w all CXX=/usr/bin/g++-4.2 CXXFLAGS="-Os -arch i386" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch i386" PREFIX=/opt/local'
DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43" && /usr/bin/make -w all CXX=/usr/bin/g++-4.2 CXXFLAGS="-Os -arch i386" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch i386" PREFIX=/opt/local 
make: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
Makefile:14: depend: No such file or directory
/usr/bin/g++-4.2 -MM Ui.cpp main.cpp Block.cpp Well.cpp BlockPosition.cpp Config.cpp BlockChooser.cpp BastetBlockChooser.cpp > depend
make: Leaving directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
make: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
/usr/bin/g++-4.2 -Os -arch i386   -c -o Ui.o Ui.cpp
/usr/bin/g++-4.2 -Os -arch i386   -c -o main.o main.cpp
/usr/bin/g++-4.2 -Os -arch i386   -c -o Block.o Block.cpp
/usr/bin/g++-4.2 -Os -arch i386   -c -o Well.o Well.cpp
/usr/bin/g++-4.2 -Os -arch i386   -c -o BlockPosition.o BlockPosition.cpp
/usr/bin/g++-4.2 -Os -arch i386   -c -o Config.o Config.cpp
/usr/bin/g++-4.2 -Os -arch i386   -c -o BlockChooser.o BlockChooser.cpp
/usr/bin/g++-4.2 -Os -arch i386   -c -o BastetBlockChooser.o BastetBlockChooser.cpp
/usr/bin/g++-4.2 -ggdb -o bastet Ui.o main.o Block.o Well.o BlockPosition.o Config.o BlockChooser.o BastetBlockChooser.o -L/opt/local/lib -Wl,-headerpad_max_install_names -arch i386 -lboost_program_options
ld: library not found for -lboost_program_options
collect2: ld returned 1 exit status
make: *** [bastet] Error 1
make: Leaving directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'

Usually detecting whether to use the single-threaded or multi-threaded boost libraries is something you would do in your configure script; since bastet does not have a configure script, I'm not sure what you should do. I suppose you could at least offer a Makefile variable for controlling the boost library suffix, but ideally you would detect it automatically and use the best-available library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.