encoder: use context allocator
make decoder keep track of truncation state
optimize fragmented parsing test