Fix potential overflow in MessageQueue
am: e22d925e42

Change-Id: I11f8f449aab97fe573c5761fd894a424617b36e5