Giter Club home page Giter Club logo

daedalus's Introduction

daedalus's People

Contributors

cruiserone 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

Watchers

 avatar  avatar

daedalus's Issues

Inverting pixel colors appears to only effect a few pixels

Running the following command on Ubuntu: ./daedalus 'cr Size 200 100 0 0 P cDel Delay 1000 SaveBitmap "newmaze.bmp"'

It looks like only a few of the pixels are getting inverted. I thought perhaps the script was proceeding to the SaveBitmap instruction too soon, so I added a Delay, but that didn't seem to help. Possible bug, or am I doing something wrong?

newmaze

Memory ovewrite on Ubuntu

I cloned the code on Ubuntu 20.04, commented out #define WIN and #define PC in util.h and compiled using the makefile mentioned in #1.
Build was successful and I was able to generate mazes. But for some values of Size parameters, it crashes

user@MYLABVM:~/Daedalus-master$ ./daedalus 'Size 35 35 1 0 ab P SaveText "files/QWoGKzqOxF"'
malloc(): corrupted top size
Aborted (core dumped)
user@MYLABVM:~/Daedalus-master$ 

Interestingly
./daedalus 'Size 34 34 1 0 ab P SaveText "files/QWoGKzqOxF"' and ./daedalus 'Size 36 36 1 0 ab P SaveText "files/QWoGKzqOxF"' worked without any issue.

gdb to see where the crash is:

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7a98859 in __GI_abort () at abort.c:79
#2  0x00007ffff7b0329e in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7c2d298 "%s\n") at ../sysdeps/posix/libc_fatal.c:155
#3  0x00007ffff7b0b32c in malloc_printerr (str=str@entry=0x7ffff7c2b569 "malloc(): corrupted top size") at malloc.c:5347
#4  0x00007ffff7b0e6ea in _int_malloc (av=av@entry=0x7ffff7c62b80 <main_arena>, bytes=bytes@entry=289) at malloc.c:4107
#5  0x00007ffff7b10184 in __GI___libc_malloc (bytes=289) at malloc.c:3058
#6  0x00005555555a2213 in PAllocate (lcb=lcb@entry=289) at daedalus.cpp:3014
#7  0x0000555555583670 in CMaz::RecursiveGenerate (this=this@entry=0x55555561a778 <bm+120>, xs=4, ys=ys@entry=12) at create.cpp:605
#8  0x0000555555583990 in CMaz::CreateMazeRecursive (this=0x55555561a778 <bm+120>) at create.cpp:680
#9  0x00005555555786c3 in DoCommand (wCmd=1119) at command.cpp:5318
#10 0x000055555557aeab in RunCommandLine (szLine=0x7fffffffde70 "Size 35 35 1 0 ab P SaveText \"files/QWoGKzqOxF\" ", file=0x0) at command.cpp:6153
#11 0x00005555555a96d1 in main (argc=<optimized out>, argv=<optimized out>) at daedalus.cpp:2942
(gdb)

I suspected memory overwrite so I ran it with valgrind:

user@MYLABVM:~/Daedalus-master$ valgrind ./daedalus 'Size 35 35 1 0 ab P SaveText "files/QWoGKzqOxF"'
==339293== Memcheck, a memory error detector
==339293== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==339293== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==339293== Command: ./daedalus Size\ 35\ 35\ 1\ 0\ ab\ P\ SaveText\ "files/QWoGKzqOxF"
==339293==
==339293== Invalid read of size 8
==339293==    at 0x171CA6: CMon::Set(int, int, long) (graphics.cpp:335)
==339293==    by 0x17689C: CMap::FBitmapShiftBy(int, int) (graphics.cpp:1900)
==339293==    by 0x15468F: DoSize(int, int, int, int) (daedalus.cpp:530)
==339293==    by 0x12FF3F: DoOperation(int, char**, int const*, long const*, _IO_FILE*) (command.cpp:3119)
==339293==    by 0x12EF0E: RunCommandLine(char*, _IO_FILE*) (command.cpp:6166)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==  Address 0x4db9b54 is 276 bytes inside a block of size 280 alloc'd
==339293==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==339293==    by 0x156212: PAllocate(long) (daedalus.cpp:3014)
==339293==    by 0x17199C: CMon::FAllocate(int, int, CMap const*) (graphics.cpp:257)
==339293==    by 0x176837: CMap::FBitmapShiftBy(int, int) (graphics.cpp:1896)
==339293==    by 0x15468F: DoSize(int, int, int, int) (daedalus.cpp:530)
==339293==    by 0x12FF3F: DoOperation(int, char**, int const*, long const*, _IO_FILE*) (command.cpp:3119)
==339293==    by 0x12EF0E: RunCommandLine(char*, _IO_FILE*) (command.cpp:6166)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==
==339293== Invalid write of size 8
==339293==    at 0x17231C: CMon::BitmapSet(long) (graphics.cpp:1545)
==339293==    by 0x1920F7: CMaz::MazeClear(long) (maze.cpp:210)
==339293==    by 0x137947: CMaz::CreateMazeRecursive() (create.cpp:677)
==339293==    by 0x12C6C2: DoCommand(int) (command.cpp:5318)
==339293==    by 0x12EEAA: RunCommandLine(char*, _IO_FILE*) (command.cpp:6153)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==  Address 0x4db9b54 is 276 bytes inside a block of size 280 alloc'd
==339293==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==339293==    by 0x156212: PAllocate(long) (daedalus.cpp:3014)
==339293==    by 0x17199C: CMon::FAllocate(int, int, CMap const*) (graphics.cpp:257)
==339293==    by 0x176837: CMap::FBitmapShiftBy(int, int) (graphics.cpp:1896)
==339293==    by 0x15468F: DoSize(int, int, int, int) (daedalus.cpp:530)
==339293==    by 0x12FF3F: DoOperation(int, char**, int const*, long const*, _IO_FILE*) (command.cpp:3119)
==339293==    by 0x12EF0E: RunCommandLine(char*, _IO_FILE*) (command.cpp:6166)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==
==339293== Invalid write of size 8
==339293==    at 0x17231C: CMon::BitmapSet(long) (graphics.cpp:1545)
==339293==    by 0x1920F7: CMaz::MazeClear(long) (maze.cpp:210)
==339293==    by 0x139CAD: CMaz::CreateMazePerfect() (create.cpp:205)
==339293==    by 0x12C65E: DoCommand(int) (command.cpp:5301)
==339293==    by 0x12EEAA: RunCommandLine(char*, _IO_FILE*) (command.cpp:6153)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==  Address 0x4db9b54 is 276 bytes inside a block of size 280 alloc'd
==339293==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==339293==    by 0x156212: PAllocate(long) (daedalus.cpp:3014)
==339293==    by 0x17199C: CMon::FAllocate(int, int, CMap const*) (graphics.cpp:257)
==339293==    by 0x176837: CMap::FBitmapShiftBy(int, int) (graphics.cpp:1896)
==339293==    by 0x15468F: DoSize(int, int, int, int) (daedalus.cpp:530)
==339293==    by 0x12FF3F: DoOperation(int, char**, int const*, long const*, _IO_FILE*) (command.cpp:3119)
==339293==    by 0x12EF0E: RunCommandLine(char*, _IO_FILE*) (command.cpp:6166)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==
==339293== Invalid read of size 8
==339293==    at 0x171588: _Get (graphics.h:249)
==339293==    by 0x171588: CMon::Get(int, int) const (graphics.cpp:319)
==339293==    by 0x179966: CMon::WriteText(_IO_FILE*, int, int, int) const (graphics.cpp:2827)
==339293==    by 0x1561E3: FWriteFile(CMaz const&, CMazK const&, int, char const*, char const*) (daedalus.cpp:440)
==339293==    by 0x15D8BB: FFileSave(int, char const*) (daedalus.cpp:3249)
==339293==    by 0x12FD7B: DoOperation(int, char**, int const*, long const*, _IO_FILE*) (command.cpp:3069)
==339293==    by 0x12EF0E: RunCommandLine(char*, _IO_FILE*) (command.cpp:6166)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==  Address 0x4db9b54 is 276 bytes inside a block of size 280 alloc'd
==339293==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==339293==    by 0x156212: PAllocate(long) (daedalus.cpp:3014)
==339293==    by 0x17199C: CMon::FAllocate(int, int, CMap const*) (graphics.cpp:257)
==339293==    by 0x176837: CMap::FBitmapShiftBy(int, int) (graphics.cpp:1896)
==339293==    by 0x15468F: DoSize(int, int, int, int) (daedalus.cpp:530)
==339293==    by 0x12FF3F: DoOperation(int, char**, int const*, long const*, _IO_FILE*) (command.cpp:3119)
==339293==    by 0x12EF0E: RunCommandLine(char*, _IO_FILE*) (command.cpp:6166)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==
==339293== Invalid read of size 8
==339293==    at 0x171588: _Get (graphics.h:249)
==339293==    by 0x171588: CMon::Get(int, int) const (graphics.cpp:319)
==339293==    by 0x179A4A: CMon::WriteText(_IO_FILE*, int, int, int) const (graphics.cpp:2830)
==339293==    by 0x1561E3: FWriteFile(CMaz const&, CMazK const&, int, char const*, char const*) (daedalus.cpp:440)
==339293==    by 0x15D8BB: FFileSave(int, char const*) (daedalus.cpp:3249)
==339293==    by 0x12FD7B: DoOperation(int, char**, int const*, long const*, _IO_FILE*) (command.cpp:3069)
==339293==    by 0x12EF0E: RunCommandLine(char*, _IO_FILE*) (command.cpp:6166)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==  Address 0x4db9b54 is 276 bytes inside a block of size 280 alloc'd
==339293==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==339293==    by 0x156212: PAllocate(long) (daedalus.cpp:3014)
==339293==    by 0x17199C: CMon::FAllocate(int, int, CMap const*) (graphics.cpp:257)
==339293==    by 0x176837: CMap::FBitmapShiftBy(int, int) (graphics.cpp:1896)
==339293==    by 0x15468F: DoSize(int, int, int, int) (daedalus.cpp:530)
==339293==    by 0x12FF3F: DoOperation(int, char**, int const*, long const*, _IO_FILE*) (command.cpp:3119)
==339293==    by 0x12EF0E: RunCommandLine(char*, _IO_FILE*) (command.cpp:6166)
==339293==    by 0x15D6D0: main (daedalus.cpp:2942)
==339293==
==339293==
==339293== HEAP SUMMARY:
==339293==     in use at exit: 32,000 bytes in 1 blocks
==339293==   total heap usage: 7 allocs, 6 frees, 109,897 bytes allocated
==339293==
==339293== LEAK SUMMARY:
==339293==    definitely lost: 0 bytes in 0 blocks
==339293==    indirectly lost: 0 bytes in 0 blocks
==339293==      possibly lost: 0 bytes in 0 blocks
==339293==    still reachable: 32,000 bytes in 1 blocks
==339293==         suppressed: 0 bytes in 0 blocks
==339293== Rerun with --leak-check=full to see details of leaked memory
==339293==
==339293== For lists of detected and suppressed errors, rerun with: -s
==339293== ERROR SUMMARY: 12 errors from 5 contexts (suppressed: 0 from 0)
user@MYLABVM:~/Daedalus-master$

Machine config:

user@MYLABVM:~/Daedalus-master$ uname -a
Linux MYLABVM 5.15.0-76-generic #83~20.04.1-Ubuntu SMP Wed Jun 21 20:23:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
user@MYLABVM:~/Daedalus-master$

Please let me know if you need any more information.

Building on Ubuntu fails on `color.o`

Building on Ubuntu 18.04 after commenting out #define WIN in util.h, using the following makefile

  1 NAME = daedalus
  2 OBJ = color.o command.o create.o create2.o create3.o daedalus.o draw.o draw2.o game.o graphics.o inside.o labyrnth.o maze.o solids.o solve.o threed.o util.o
  3 LIBS = -lm
  4 CPPFLAGS = -O -Wno-write-strings -Wno-narrowing -Wno-comment
  5 daedalus:: $(OBJ)
  6     g++ -o $(NAME) $(OBJ) $(LIBS)
  7     strip $(NAME)

make returns many notes and errors. Beginning and end of output below.

g++  -O -Wno-write-strings -Wno-narrowing -Wno-comment  -c -o color.o color.cpp
In file included from color.cpp:33:0:
util.h:228:26: error: expected initializer before ‘qword’
 typedef unsigned __int64 qword;
                          ^~~~~
util.h:232:26: error: expected initializer before ‘uquad’
 typedef unsigned __int64 uquad;
                          ^~~~~
util.h:235:9: error: ‘__int64’ does not name a type; did you mean ‘__rintf64’?
 typedef __int64 quad;
         ^~~~~~~
         __rintf64

...

util.h:54:17: error: ‘sprintf_s’ was not declared in this scope
 #define sprintf sprintf_s
                 ^
color.cpp:2805:3: note: in expansion of macro ‘sprintf’
   sprintf(SS(sz, cch), "rgb %d %d %d", RgbR(kv), RgbG(kv), RgbB(kv));
   ^~~~~~~
util.h:54:17: note: suggested alternative: ‘sprintf’
 #define sprintf sprintf_s
                 ^
color.cpp:2805:3: note: in expansion of macro ‘sprintf’
   sprintf(SS(sz, cch), "rgb %d %d %d", RgbR(kv), RgbG(kv), RgbB(kv));
   ^~~~~~~
color.cpp: In function ‘KV ParseColorCore(char**, flag)’:
util.h:55:16: error: ‘sscanf_s’ was not declared in this scope
 #define sscanf sscanf_s
                ^
color.cpp:2820:3: note: in expansion of macro ‘sscanf’
   sscanf(*ppch, "%s", S(line));
   ^~~~~~
util.h:55:16: note: suggested alternative: ‘sscanf’
 #define sscanf sscanf_s
                ^
color.cpp:2820:3: note: in expansion of macro ‘sscanf’
   sscanf(*ppch, "%s", S(line));
   ^~~~~~
<builtin>: recipe for target 'color.o' failed
make: *** [color.o] Error 1

Loop hang

In the file create3.cpp in function void Generic::GenerateWireframe() at lines 254-256 there is this part:
loop {
if (!FIsOnMaze(area) || !FIsRoom(area))
continue;

If the condition is true the function infinitely evaluates the condition.
Maybe the continue was supposed to belong to the outer for loop at line 251?
Or maybe it is supposed to be:
loop {
if (!FIsOnMaze(area) || !FIsRoom(area)) {
area = LNext(area);
continue;
}

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.