pan/decode: Add static bounds checking utility