Details
Key changes:
- Remove `bytes.TrimRight(data, "\x00")` entirely — it corrupts valid PKCS#7-padded data and creates the empty-slice condition.
- Bounds-check `padLength` before using it as a slice index.
- Validate all padding bytes match (proper PKCS#7 verification).
- Return errors instead of panicking on malformed input.