Getting segmentation fault SIGSEGV in memcpy after mmap

前端 未结 4 1800
既然无缘
既然无缘 2021-01-23 16:50

I wrote a simple Android native function that get a filename and some more arguments and read the file by mmapping (mmap) it\'s memory.

Because it\'s mmap, I don\'t real

4条回答
  •  时光说笑
    2021-01-23 17:22

    The condition in while(ret_val == buffer || read_length is wrong. ret_val == buffer will always be true, and if read_length is true when the loop is reached, it will always remain true because read_length is only ever reduced (well, until it underflows INT_MIN).

提交回复
热议问题