From: drh <> Date: Wed, 3 Jun 2026 10:55:08 +0000 (+0000) Subject: Make the (unused, untested, and unsupported) ext/misc/compress.c routines X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=1c0a370472283916a347fd37e045e27d600e546b;p=thirdparty%2Fsqlite.git Make the (unused, untested, and unsupported) ext/misc/compress.c routines responsive to OOM conditions. [bugs:/info/2026-06-03T08:28:36Z|Bug 2026-06-03T08:28:36Z]. FossilOrigin-Name: e3120e2a4339d51210645b14d075abba27dd97bd6bd6d42f445dd5baf3d337e3 --- diff --git a/ext/misc/compress.c b/ext/misc/compress.c index 48ea5182d7..a6b4e23e8d 100644 --- a/ext/misc/compress.c +++ b/ext/misc/compress.c @@ -60,6 +60,10 @@ static void compressFunc( nIn = sqlite3_value_bytes(argv[0]); nOut = 13 + nIn + (nIn+999)/1000; pOut = sqlite3_malloc64( nOut+5 ); + if( pOut==0 ){ + sqlite3_result_error_nomem(context); + return; + } for(i=4; i>=0; i--){ x[i] = (nIn >> (7*(4-i)))&0x7f; } @@ -99,6 +103,10 @@ static void uncompressFunc( if( (pIn[i]&0x80)!=0 ){ i++; break; } } pOut = sqlite3_malloc64( nOut+1 ); + if( pOut==0 ){ + sqlite3_result_error_nomem(context); + return; + } rc = uncompress(pOut, &nOut, &pIn[i], nIn-i); if( rc==Z_OK ){ sqlite3_result_blob(context, pOut, nOut, sqlite3_free); diff --git a/manifest b/manifest index e7b5c84437..15ca91ab7d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scase\swhere\ssqlite3expert\scould\sbe\stricked\sinto\sexecuting\sarbitrary\sSQL\sby\sa\scorrupt\sdatabase\sschema. -D 2026-06-02T15:20:37.168 +C Make\sthe\s(unused,\suntested,\sand\sunsupported)\sext/misc/compress.c\sroutines\nresponsive\sto\sOOM\sconditions.\n[bugs:/info/2026-06-03T08:28:36Z|Bug\s2026-06-03T08:28:36Z]. +D 2026-06-03T10:55:08.933 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -370,7 +370,7 @@ F ext/misc/btreeinfo.c 5fe97f798a9ee90e92b3031ed7969ec3f558661bb36b821c3ba045a17 F ext/misc/cksumvfs.c 9d7d0cf1a8893ac5d48922bfe9f3f217b4a61a6265f559263a02bb2001259913 F ext/misc/closure.c c983987a8d7846c3e52b1885ed3e20af7d4ca52a81a8f94ec6d1cd68f93acc86 F ext/misc/completion.c 3f5db28e88c3313103b2dd86d910a2944fd500c46754e473493968ce81e994a4 -F ext/misc/compress.c 8191118b9b73e7796c961790db62d35d9b0fb724b045e005a5713dc9e0795565 +F ext/misc/compress.c 5cc142aa82d1589a31c384657d0418c0eb0871348a2201e5dca32d24a0dd6654 F ext/misc/csv.c 5e9d4dd749e762c144104c0f01db5bf4458735b19081ebe481a64e589a66687a F ext/misc/dbdump.c 678f1b9ae2317b4473f65d03132a2482c3f4b08920799ed80feedd2941a06680 F ext/misc/decimal.c 432e5b03a0e2a68a1846a9852a565a1b546ca9b295deda834e4653f0f5577daa @@ -2207,8 +2207,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 83fe72bcdf866bdaf3043ae5b0c1eb45a9d50a01b24b7a531858271dd746baab -R 143b4f8790f9d171f14ed00c4c3f7e44 -U dan -Z c03081a5d47dc2254e97d2e8de39c97f +P 8a633070e62bdc83a7cf895fd1a22c04b13579659df7cee9584d95096bfffab1 +R 1296c8d935285f91f86e348810ae57f2 +U drh +Z f9fc0189951370a9381fefa4c165504e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b1b4498229..4315a16ceb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8a633070e62bdc83a7cf895fd1a22c04b13579659df7cee9584d95096bfffab1 +e3120e2a4339d51210645b14d075abba27dd97bd6bd6d42f445dd5baf3d337e3