Comment #1 on issue 377 by [email protected]: unknown-crash with annotate_contiguous_container
https://code.google.com/p/address-sanitizer/issues/detail?id=377

Small mistake in the provided code, doesn't affect the result.

#include <stdio.h>
#include <stdint.h>

// Not 8-aligned
#define SIZ 132

struct foo {
  uint32_t a;
  char buf[SIZ] __attribute ((aligned(8)));
};

void setup_stack() {
  struct foo blah1;
  struct foo blah2;
  struct foo blah3;
  printf("%p %p %p\n", &blah1, &blah2, &blah3);
  char *lol = &(blah2.buf);
  printf("lol = %p\n", lol);

  __sanitizer_annotate_contiguous_container(lol, lol+SIZ, lol+SIZ, lol+0);
  __sanitizer_annotate_contiguous_container(lol, lol+SIZ, lol+0, lol+SIZ);
  printf("setup_stack done\n");
}

void crash() {
  volatile char buf[1024];
  printf("buf = %p\n", buf);
  int i;
  for (i = 0; i < 1024; i++) {
    printf("%d\n", buf[i]);
  }
}

int main(int argc, char *argv[]) {
  setup_stack();
  crash();
  return 0;
}

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to