SQLite
Ticket Change Details
Not logged in
Overview

Artifact ID: ba0773221d7d6f2d318769276c437df09510d1da
Ticket: 5eaa61ea1881040b17449ca043b6f8fd9ca55dc3
sigbus on disk ful in WAL mode
Date: 2012-11-13 01:24:10
User: drh
Changes

  1. Change comment to:

    Attempts to prepare a query on a WAL database when the disk space is critically low result in the process killed with BUS. The crash happens in walIndexWriteHdr invoked from walIndexRecover:

     643 static void walIndexWriteHdr(Wal *pWal){
     [...]
     650   walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);
     651   memcpy((void *)&aHdr[1], (void *)&pWal->hdr, sizeof(WalIndexHdr)); << sigbus here
    

    Since i don't know if I'll be able to attache a PoC after submitting this ticket, I'm adding it here in base64.

    base64 -d > mountme.bz2 << EOF
    QlpoOTFBWSZTWdl2FE4AAEd////////v7/5e/////L9v/+xv38ZSbAdOQV4FRCTR3/3s0ARNY3on
    aVG5ydncNEgTQE09IyngieU8gh6TINNPUAGmjQ2o0HpDQNNHqHqAAADTQ9RoeU0GR5Q8kBoZNqeo
    NEJpkRojCniamZNJo02oAzUNNGmyg0DIAAAAABoAAAAAANAaAAAxFE0Jij0J6hp5NR6Rk0ANAZBo
    GgAAAADQAAAAAAAAABoDQAgNDINMmmgYTQGhpk0aYEZGTQZDJkGRpkaNMg0aAGCNNBiGgAZNDJgI
    0GjQJFJRNNNDIGjTIbU0HqABoaaZDINAAAADQBiAGIGjQyNNGgAZMI0ZNDJoU3MeFxkkc3Z41hbW
    8jDkSjtOhgCTZvZDyAuQe9MlnyUJRsnBSKCqYknJpalrzfoZNLCdV70TdiIXxMRuU2IRkQJqG8QZ
    OQb+iYlGMFPlV0OmpxTALbroIwQMEAHxal5pbiPEEKHH0kN2QtWKoGkgJsW5O0ayrdAnCOCFYLWw
    lLfOMYqAyp0kAifKYYjJCJmGkTTtwu6OsOY0RUoOiYDGtSQctLi3zirl93O1IcPEMJd2yfKOo5VC
    tWwG8FR62hLdnPEziKCWNRAajF4a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KZ1qbCYDBkg7H8sTf6oDqczF/X79LiIqxb1boNG662tp/Vz7JfwSCL6w4+2fqk3
    ym9/ynQJUzxwAZf7EwajzMXWBxQgiIjYJJ0YJATYEIr+KoYlEwFWSnnjkI3piIP1ycNM6496w1SD
    V/Xf8tkMAB4Ffbf/i7kinChIbLsKJwA=
    EOF
    
    Then:
    bunzip2 mountme.bz2
    mount -o loop mountme /mnt
    
    Finally:
    # sqlite3 /mnt/db.sqlite3 
    SQLite version 3.7.14.1 2012-10-04 19:37:12
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    sqlite> .tables
    Bus error
    
  2. Change priority to "Immediate"
  3. Change resolution to "Open"