Coder Social home page Coder Social logo

chadstr's People

Contributors

carimura avatar mdukat avatar skullchap avatar sneedcat avatar zkscpqm 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

chadstr's Issues

Cannot compile chadstr.h using MSVC

main.c

#include "chadstr.h"

int main() {
	chadstr test = str("orange apple");
	return 0;
}

The result when I try to compile it:

D:\workspace\chadstr>cl /I. main.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29915 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

main.c
D:\workspace\chadstr\chadstr.h(69): fatal error C1112: compiler limit: '129' too many macro arguments, only '127' allowed

'cleanup' attribute only applies to local variables

I know even if this is a kind-of meme, it's a severe limitation for my personal use.
I guess compilers ain't that smart after all....

Now I am back at the dumb strdup stuff I've been struggling with :(

AddressSanitizer: dynamic-stack-buffer-overflow

take example code generate random strings and compile with sanitizers.

$ gcc -fsanitize=address main.c 
# ./a.out 
=================================================================
==567==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7ffe55e4a198 at pc 0x55b34322c058 bp 0x7ffe55e4a0e0 sp 0x7ffe55e4a0d8
WRITE of size 1 at 0x7ffe55e4a198 thread T0
    #0 0x55b34322c057 in random_string (/root/chadstr/a.out+0x4057)
    #1 0x55b34322c1f6 in main (/root/chadstr/a.out+0x41f6)
    #2 0x7f2811d11d09 in __libc_start_main ../csu/libc-start.c:308
    #3 0x55b34322a249 in _start (/root/chadstr/a.out+0x2249)

Address 0x7ffe55e4a198 is located in stack of thread T0
SUMMARY: AddressSanitizer: dynamic-stack-buffer-overflow (/root/chadstr/a.out+0x4057) in random_string
Shadow bytes around the buggy address:
  0x10004abc13e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004abc13f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004abc1400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004abc1410: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004abc1420: ca ca ca ca 00 00 00 00 00 00 00 00 00 00 00 00
=>0x10004abc1430: 00 00 00[cb]cb cb cb cb 00 00 00 00 00 00 00 00
  0x10004abc1440: 00 00 00 00 00 00 f1 f1 f1 f1 00 f2 f2 f2 00 00
  0x10004abc1450: f3 f3 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
  0x10004abc1460: 00 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004abc1470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10004abc1480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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
  Shadow gap:              cc
==567==ABORTING
$

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.