I implemented unsigned varint off a blog post. The blog post was wrong. The spec was not. Tests against a known-good encoder saved me.
Do not implement encodings from memory. Implement them from the spec and a test vector.
Refs: IETF
Lab / educational. Public binaries and patched classes only. Isolated VM.