##// END OF EJS Templates
lazymanifest: don't depend on printf's 'hh' format to work...
lazymanifest: don't depend on printf's 'hh' format to work Where we convert a 20-byte binary to a 40-byte hex string in lazymanifest_setitem(), we use sprintf("%02hhx", hash[i]). As Matt Harbison found out, 'hh' seems to be ignored on some platforms (Visual Studio?). If char is signed on such platforms, the value gets sign-extended as it gets promoted into an int when passed into the variadic sprintf(). The resulting integer value will then be printed with leading f's (14 of them on 64-bit systems), since the '2' in the format string indicates only minimum number of characters. This is both incorrect and runs the risk of writing outside of allocated memory (as Matt reported). To fix, let's cast the value to unsigned char before passing it to sprintf(). Also drop the poorly supported 'hh' formatting that now becomes unnecessary.
Martin von Zweigbergk -
r24286:40528ad1 default
Show More
Name Size Modified Last Commit Author
/ hgext
convert
highlight
largefiles
zeroconf
__init__.py Loading ...
acl.py Loading ...
blackbox.py Loading ...
bugzilla.py Loading ...
children.py Loading ...
churn.py Loading ...
color.py Loading ...
eol.py Loading ...
extdiff.py Loading ...
factotum.py Loading ...
fetch.py Loading ...
gpg.py Loading ...
graphlog.py Loading ...
hgcia.py Loading ...
hgk.py Loading ...
histedit.py Loading ...
keyword.py Loading ...
mq.py Loading ...
notify.py Loading ...
pager.py Loading ...
patchbomb.py Loading ...
progress.py Loading ...
purge.py Loading ...
rebase.py Loading ...
record.py Loading ...
relink.py Loading ...
schemes.py Loading ...
share.py Loading ...
shelve.py Loading ...
strip.py Loading ...
transplant.py Loading ...
win32mbcs.py Loading ...
win32text.py Loading ...