u/johnP - 11 Archived Voat Posts in v/programming
u/johnP
  • home
  • search

u/johnP

1 post · 10 comments · 11 total

Active in: v/programming (11)

  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››
Comment on: Programing is not about intelligence or perfection. That works against you!

you probably crate more readable code

You misspelled the word 'fuck'.

2 07 Jul 2016 22:38 u/johnP in v/programming
Comment on: [Why does my code work] I have created a parser in C and if I do not allocate and immediately free an array it breaks.

Nah, it's fine. I just can't see!

2 16 Jun 2016 02:38 u/johnP in v/programming
Comment on: [Why does my code work] I have created a parser in C and if I do not allocate and immediately free an array it breaks.

Yeah, didn't see that 'if' there. My fault.

2 16 Jun 2016 02:29 u/johnP in v/programming
Comment on: [Why does my code work] I have created a parser in C and if I do not allocate and immediately free an array it breaks.

Nope. Sorry about that gentlemen, totally didn't see the 'if' there. My fault. I would still do a check to make sure your allocation routine isn't getting called with a zero.

1 16 Jun 2016 02:27 u/johnP in v/programming
Comment on: [Why does my code work] I have created a parser in C and if I do not allocate and immediately free an array it breaks.

Of course he's got some kind of memory corruption.

1 16 Jun 2016 02:14 u/johnP in v/programming
Comment on: [Why does my code work] I have created a parser in C and if I do not allocate and immediately free an array it breaks.

Dude, that stuff doesn't matter. You can't do this:

char* inputBufferSubset = allocCharBuffer(inputBufferLength);
memcpy(inputBufferSubset, &input[i-inputBufferLength], inputBufferLength);

inputBufferLength starts out at 0. You're overwriting memory you're not supposed to.

0 16 Jun 2016 02:12 u/johnP in v/programming
Comment on: [Why does my code work] I have created a parser in C and if I do not allocate and immediately free an array it breaks.

Doesn't matter what happens later. He's modifying memory that's not been allocated properly.

char* inputBufferSubset = allocCharBuffer(inputBufferLength);
memcpy(inputBufferSubset, &input[i-inputBufferLength], inputBufferLength);
1 16 Jun 2016 02:08 u/johnP in v/programming
Comment on: [Why does my code work] I have created a parser in C and if I do not allocate and immediately free an array it breaks.

Your problem is here:

char* inputBufferSubset = allocCharBuffer(inputBufferLength);

And inputBufferLength starts out at 0. Anything else that happens in the program is up for grabs because you might be overwriting some data structure used by the allocator or something.

0 16 Jun 2016 02:02 u/johnP in v/programming
Comment on: [Why does my code work] I have created a parser in C and if I do not allocate and immediately free an array it breaks.

It looks like inputBufferLength is starting out at zero. And then allocCharBuffer(inputBufferLength) gets called which calls malloc with a length of zero. I guess malloc returns the pointer anyway. Yep I just tested it and it does on my system too.

Here's some junk about it: https://bytes.com/topic/c/answers/578467-what-malloc-0-should-returns

2 16 Jun 2016 01:45 u/johnP in v/programming
Live OpenGL programming with Erlang.
6 0 comments 04 Jun 2016 23:01 u/johnP (self.programming) in v/programming
Comment on: Extremely severe bug leaves dizzying number of software and devices vulnerable

It looks like if you're running debian it's already fixed so you just have to update with apt:

https://www.debian.org/security/2016/dsa-3481

1 17 Feb 2016 23:13 u/johnP in v/programming
  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››

archive has 9,592 posts and 65,719 comments. source code.