← Commit list

f74f280a1

Denys Vlasenko
Denys Vlasenko
2011-10-19
FAILED Duration: 225s

Subject

get_header_tar: shrink 6->64 sign extension code

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

archival/libarchive/get_header_tar.c+4 -4
@@ -79,10 +79,10 @@ static unsigned long long getOctal(char *str, int len)
*
* NB: tarballs with NEGATIVE unix times encoded that way were seen!
*/
- v = first;
- /* Sign-extend using 6th bit: */
- v <<= sizeof(unsigned long long)*8 - 7;
- v = (long long)v >> (sizeof(unsigned long long)*8 - 7);
+ /* Sign-extend 7bit 'first' to 64bit 'v' (that is, using 6th bit as sign): */
+ first <<= 1;
+ first >>= 1; /* now 7th bit = 6th bit */
+ v = first; /* sign-extend 8 bits to 64 */
while (--len != 0)
v = (v << 8) + (unsigned char) *str++;
}