yandex / pire

Perl Incompatible Regular Expressions library
http://github.com/dprokoptsev/pire/wiki
Other
330 stars 30 forks source link

run: deal with pointers safely #37

Closed sorc1 closed 8 years ago

sorc1 commented 8 years ago

Impl::DoRun() implies that sizeof(void *) == sizeof(size_t). But there is no such guarantee.

So it is safer to:

  1. Use sizeof(size_t) instead of sizeof(void *)
  2. Cast (char *) to uintptr_t when calculating unaligned pointers offsets