• topjohnwu's avatar
    Fix integer overflow and workaround seccomp · 528601d2
    topjohnwu authored
    - Use ftruncate64 instead of ftruncate to workaround seccomp
    - Cast uint32_t to off64_t before making it negative
    
    Note: Using ftruncate with a modern NDK libc should actually be
    fine as the syscall wrapper in bionic will use ftruncate64 internally.
    However, since we are using the libc.a from r10e built for Gingerbread,
    seccomp wasn't a thing back then, and also the ftruncate64 symbol is
    missing; we have to create our own wrapper and call it instead on
    32-bit ABIs.
    
    Props to @jnotuo for discovering the overflow bug and seccomp issue
    
    Fix #3703, close #4915
    528601d2
missing.cpp 4.34 KB