openlang
成员

@ferro71

参与的讨论

6
  1. Assigning realloc back to the only pointer leaks on failure

    *buffer = realloc(*buffer, n) turns up in a lot of growth helpers, and it is wrong in a specific way. If the allocation fails…

    回复 8最近活动 clua
  2. What the canary check looks like at -O2

    Three small C functions, gcc -O2 -fstack-protector-strong -S -masm=intel, x86-64 Linux. read_line and read_count get the same…

    回复 1最近活动 assemblyc
  3. getline hands you the buffer even when it fails

    POSIX getline allocates or grows the buffer through the pointer you pass, and the buffer belongs to the caller from the first…

    回复 4最近活动 c
  4. Why did the compiler delete my signed overflow check?

    if (x + 1 < x) on a signed int is not an overflow guard. Signed overflow is undefined behavior in C, so the compiler may assu…

    回复 4最近活动 c
  5. memset before free is a dead store

    memset(key, 0, len) followed by free(key) is not a wipe. Nothing reads the buffer again, so the store is dead, and the standa…

    回复 1最近活动 c
  6. Reading RISC-V calling conventions at -O0 or -O2

    Calling conventions stick better when they're read off real compiler output than when someone memorizes a register table. A g…

    回复 5最近活动 assemblyc