Giter Club home page Giter Club logo

kamby's Introduction

Kamby

Kamby Programming Language is a Lisp dialect with some conventions to create a lange more intuitive and compact.

Lisp? But it doesn't look like

Internaly the implementation follows some basic concepts like S-expressions and car/cdr as any Lisp language. Kamby has some conventions to make the syntax more friendly:

  • Anything starting with a new line and finishing in end of line is considered an expression
  • An item formed by 2 or less punctuation characters, will create an expression formed by (punct previous next). Ex.: 2 + 2 => (+ 2 2) ... something == anything => (== something anything)
  • Blocks will be evaluated if is the first item of expression.

Documentation

https://kamby.org

Known issues / TODO

  • Improve memory management

License

MIT

kamby's People

Contributors

henriquegogo avatar

Stargazers

 avatar Kyle Mitchell avatar Alvin Charity avatar Charlie Gunyon avatar Simon Howard avatar Phil Klinefelter avatar  avatar Cristian Molina avatar Xiaobo avatar Saulius Krasuckas avatar Alex Fuentes avatar  avatar Mahmoud Rusty Abdelkader avatar joao guilherme avatar Dunkan avatar Asger Alstrup Palm avatar matthew mcdonald avatar Valentin Laurent avatar Marcelo Higa avatar  avatar latrokles avatar Sergii Tykhomyrov avatar Thomas Jager avatar Jen Stehlik avatar Andrew avatar Eli Mellen avatar Magnus Nyberg avatar Jag Chadha avatar Atharva avatar Tomek Wałkuski avatar  avatar Ilmari Vacklin avatar Benji York avatar Jivan Kulkarni avatar Goh Zi He avatar Corey Montella avatar Manda Putra avatar  avatar Nikita avatar Sofia avatar Fabian Mersch avatar Chris avatar Fatih Kaya avatar Samuel Ludwig avatar  avatar Mtv Europe avatar Nikolay Vznuzdaev avatar Vidar Nelson avatar Max Zettlmeißl avatar ccmywish avatar Tony Chiodo avatar Chanh Le avatar Mihai avatar Ivan K avatar astrolemonade avatar Thorben Starsy avatar  avatar Oleg avatar Niklas Mollenhauer avatar Chuánqí Sun avatar  avatar Gerrit Proessl avatar Benoit Giannangeli avatar Suminda Sirinath Salpitikorala Dharmasena avatar Kartik Agaram avatar Mike Warot avatar Johann Chang avatar Palash Bauri avatar  avatar Noah avatar Caleb avatar  avatar Журат Максим avatar Guilherme Samuel avatar

Watchers

 avatar James Cloos avatar

Forkers

mikewarot stasoid

kamby's Issues

heap-buffer-overflow

[root@fedora kamby]# make 
clang -fsanitize=address,undefined -c -fpic -o kamby.o kamby.c
clang -fsanitize=address,undefined -shared -o libkamby.so kamby.o
rm kamby.o
clang -fsanitize=address,undefined -o kamby main.c kamby.c
[root@fedora kamby]# make test
clang -fsanitize=address,undefined -c -fpic -o kamby.o kamby.c
clang -fsanitize=address,undefined -shared -o libkamby.so kamby.o
rm kamby.o
clang -fsanitize=address,undefined -o tests tests.c -L`pwd` -lkamby
TESTING...
- Initialization
=================================================================
==997==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000013 at pc 0x000000447f5a bp 0x7fffc64a3e90 sp 0x7fffc64a3650
WRITE of size 4 at 0x602000000013 thread T0
    #0 0x447f59 in __interceptor_strcpy.part.0 asan_interceptors.cpp.o
    #1 0x7f25902fae83 in ka_idf (/root/kamby/libkamby.so+0xde83) (BuildId: 57fe31e0ce1eb6ef4c07b16b7a75f7c740f59fec)
    #2 0x7f259030c052 in ka_init (/root/kamby/libkamby.so+0x1f052) (BuildId: 57fe31e0ce1eb6ef4c07b16b7a75f7c740f59fec)
    #3 0x51275b in test_init (/root/kamby/tests+0x51275b) (BuildId: 4487b6b2fc988d4eb27ee1a3afc04555cf122ae5)
    #4 0x517724 in main (/root/kamby/tests+0x517724) (BuildId: 4487b6b2fc988d4eb27ee1a3afc04555cf122ae5)
    #5 0x7f259002da4f in __libc_start_call_main (/lib64/libc.so.6+0x23a4f) (BuildId: 705c3497077980e84480c5ea1f24241b72863722)
    #6 0x7f259002db08 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x23b08) (BuildId: 705c3497077980e84480c5ea1f24241b72863722)
    #7 0x41d3c4 in _start (/root/kamby/tests+0x41d3c4) (BuildId: 4487b6b2fc988d4eb27ee1a3afc04555cf122ae5)

0x602000000013 is located 0 bytes to the right of 3-byte region [0x602000000010,0x602000000013)
allocated by thread T0 here:
    #0 0x4cfa97 in __interceptor_malloc (/root/kamby/tests+0x4cfa97) (BuildId: 4487b6b2fc988d4eb27ee1a3afc04555cf122ae5)
    #1 0x7f25902fac12 in ka_idf (/root/kamby/libkamby.so+0xdc12) (BuildId: 57fe31e0ce1eb6ef4c07b16b7a75f7c740f59fec)
    #2 0x7f259030c052 in ka_init (/root/kamby/libkamby.so+0x1f052) (BuildId: 57fe31e0ce1eb6ef4c07b16b7a75f7c740f59fec)
    #3 0x51275b in test_init (/root/kamby/tests+0x51275b) (BuildId: 4487b6b2fc988d4eb27ee1a3afc04555cf122ae5)
    #4 0x517724 in main (/root/kamby/tests+0x517724) (BuildId: 4487b6b2fc988d4eb27ee1a3afc04555cf122ae5)
    #5 0x7f259002da4f in __libc_start_call_main (/lib64/libc.so.6+0x23a4f) (BuildId: 705c3497077980e84480c5ea1f24241b72863722)

SUMMARY: AddressSanitizer: heap-buffer-overflow asan_interceptors.cpp.o in __interceptor_strcpy.part.0
Shadow bytes around the buggy address:
  0x0c047fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c047fff8000: fa fa[03]fa fa fa 03 fa fa fa fa fa fa fa fa fa
  0x0c047fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==997==ABORTING
make: *** [Makefile:33: test] Error 1
#

Buffer overflow on string allocation

Hi!

There are many places (e.g. here) where the code copies a string by computing strlen() of a string, mallocs that size, and copies the contents with strcpy. However, this does not account for the size of the \0 at the end of the string. The code should malloc one more than the string length.

Since this is a recurring operation, it would probably be best to write a dedicated function to allocate and copy a string, to use wherever needed. On Unix, there is strdup(), but if you want to keep the code more portable, you can easily make a small function to do that.

repl?

What do you do with a lisp without printed output in the repl (if run in a terminal)?
Or did I miss something?

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.