<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>311493</bug_id>
          
          <creation_ts>2026-04-04 12:16:24 -0700</creation_ts>
          <short_desc>Crash due to nullptr deref in WebCore::SQLiteIDBBackingStore::openCursor() via infoForObjectStore()</short_desc>
          <delta_ts>2026-04-05 18:23:08 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Website Storage</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=209976</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=242257</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=270137</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>sihui_liu</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2196902</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-04-04 12:16:24 -0700</bug_when>
    <thetext>`WebCore::SQLiteIDBBackingStore::openCursor()` crashes due to a
nullptr dereference when `infoForObjectStore()` returns nullptr
because `m_databaseInfo-&gt;m_objectStoreMap` is empty.

The function calls `infoForObjectStore()`, which can return nullptr
when the object store identifier is not found in the HashMap.  The
return value is guarded only by `ASSERT(objectStoreInfo)` -- a no-op
in release builds -- and then unconditionally dereferenced via
`objectStoreInfo-&gt;keyPath()`.

The unconditional dereference is undefined behavior (UB) with
nullptr.  The compiler backward-propagates from the UB to
eliminate all nullptr checks in the entire inlined
`HashMap::find()` chain, including the internal
`if (!m_table)` check in `HashTable::inlineLookup()`.  This causes
the crash to manifest as a read from address 0xfffffffffffffff8 (null
minus 8 bytes) inside `tableSizeMask()`.

The same pattern (Debug ASSERT without a nullptr check) also
exists in `getIndexRecord()`, `uncheckedGetIndexRecordForOneKey()`,
and `iterateCursor()`.  Four other call sites in the same file
(`getRecord()`, `getAllObjectStoreRecords()`, `getAllIndexRecords()`,
`addIndex()`) already properly check for nullptr.

Stack trace:
0   WebCore:  WTF::HashTable::tableSizeMask
1   WebCore:  WTF::HashTable::inlineLookup
2   WebCore:  WTF::HashTable::find
3   WebCore:  WTF::HashMap::find
4   WebCore:  WebCore::IDBDatabaseInfo::getInfoForExistingObjectStore
5   WebCore:  WebCore::IDBServer::SQLiteIDBBackingStore::infoForObjectStore
6   WebCore:  WebCore::IDBServer::SQLiteIDBBackingStore::openCursor
7   WebCore:  WebCore::IDBServer::UniqueIDBDatabase::performOpenCursor
[...]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2196903</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-04-04 12:16:26 -0700</bug_when>
    <thetext>&lt;rdar://problem/168962352&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2197096</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2026-04-05 14:19:16 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/62088</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2197128</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-04-05 18:23:06 -0700</bug_when>
    <thetext>Committed 310618@main (acf3ca6f197b): &lt;https://commits.webkit.org/310618@main&gt;

Reviewed commits have been landed. Closing PR #62088 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>