It's better that the codec is 100% safe but there's a tiny amount of unsafe glue code, than make the codec unsafe to add generality.
Google has smart people, finding the bug in 15 lines of glue code before it goes out the door is definitely easier than finding this C bug.
This is the same thing that powers Rust successfully, but taking it further.