Status: Accepted
Owner: ----
Labels: Type-Bug Priority-Medium

New issue 3905 by [email protected]: Undefined behavior in RelocIterator::AdvanceReadPosition
https://code.google.com/p/v8/issues/detail?id=3905

I was looking at some code today and realized that AdvanceReadPosition might have undefined behavior, as a 1 might be shifted into the sign bit.

void
RelocIterator::AdvanceReadPosition() {
  int x = 0;
  for (int i = 0; i < kIntSize; i++) {
    x |= static_cast<int>(*--pos_) << i * kBitsPerByte;
  }
  last_position_ += x;
  rinfo_.data_ = last_position_;
}

Same thing for the other AdvanceRead helpers. I don't know if this matters at all, but given that an instance of undefined behavior can launch the nukes, I thought it might be worth mentioning. See also http://blog.regehr.org/archives/738.

--
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

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" 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