Fixed GH-16978: Avoid unnecessary padding with leading zeros (#16988) Fixed an issue where leading zeros were padded beyond the allocated memory. fixes #16978 closes #16988