Menu

#52 librbftest division by zero on macOS (clang)

2.3
closed-fixed
nobody
None
5
2023-07-17
2023-07-16
No

This does not happen on Linux (gcc).

make[1]: *** [testall] Floating point exception: 8
make: *** [all] Error 2
% 
% lldb ./build/unix/unittest/librbftest
(lldb) target create "./build/unix/unittest/librbftest"
Current executable set to '/Users/tormod/toolshed/build/unix/unittest/librbftest' (x86_64).
(lldb) run
Process 8281 launched: '/Users/tormod/toolshed/build/unix/unittest/librbftest' (x86_64)
Process 8281 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_ARITHMETIC (code=EXC_I386_DIV, subcode=0x0)
    frame #0: 0x000000010000dfbb librbftest`_os9_freefile(filePath="test.dsk,test4.txt", bitmap="\xff\xff") at librbfdelete.c:318:45
   315              break;
   316          }
   317  
-> 318          ec = _os9_delbit(bitmap, int3(seg[i].lsn) / path->spc,
   319                   int2(seg[i].num) / path->spc);
   320  
   321          if (ec != 0)
Target 0: (librbftest) stopped.
(lldb) frame variable *path
(_os9_path_id) *path = {
  mode = -590528416
  imgfile = 0x00000000000007fb ""
  pathlist = 0x0000000000000000
  pl_fd_lsn = 0
  filepos = 0
  fd = NULL
  lsn0 = NULL
  bitmap = 0x0000000000000000
  spc = 0
  bps = 0
  spt = 0
  t0s = 0
  cs = 0
  bitmap_bytes = 0
  israw = 0
}
(lldb) 

Discussion

  • Tormod Volden

    Tormod Volden - 2023-07-16
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,5 @@
    +This does not happen on Linux (gcc).
    +
     ~~~
     make[1]: *** [testall] Floating point exception: 8
     make: *** [all] Error 2
    
     
  • Tormod Volden

    Tormod Volden - 2023-07-17
    • status: open --> closed-fixed
     
  • Tormod Volden

    Tormod Volden - 2023-07-17

    A classic "use after free", fixed in commit 5589e087.

     

Anonymous
Anonymous

Add attachments
Cancel