mpatch: rewrite pointer overflow checks
hgweb: avoid initialization race (issue3953)