]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In os_unix.c, put ALWAYS() on unreachable branches associated with pathname
authordrh <drh@noemail.net>
Mon, 23 Nov 2020 17:36:06 +0000 (17:36 +0000)
committerdrh <drh@noemail.net>
Mon, 23 Nov 2020 17:36:06 +0000 (17:36 +0000)
normalization.

FossilOrigin-Name: b45a08e3c7edfa76b699d3e29f28daa5bd08039668ec57121e4e85edf36150f1

manifest
manifest.uuid
src/os_unix.c

index a3ce931da49c680ee741086bd9f68a561ad7e34c..f505c98e0ea9a0996d43951e82b19cd36bf09c01 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\stest\sscript\sproblem\scausing\scrash8.test\sto\sfail\swhen\srun\swith\sleak-sanitizer.
-D 2020-11-23T15:30:16.535
+C In\sos_unix.c,\sput\sALWAYS()\son\sunreachable\sbranches\sassociated\swith\spathname\nnormalization.
+D 2020-11-23T17:36:06.943
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -523,7 +523,7 @@ F src/os.c 80e4cf3e5da06be03ca641661e331ce60eeeeabf0d7354dbb1c0e166d0eedbbe
 F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
 F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c 7c42aa79024d259635a6e5099b03276942bed7d33fc2e5f76f71445042977f10
+F src/os_unix.c adbbcea4c63d3b400d405f60a5da4c01433753ec4a12e2dc695beb2bbd671fe9
 F src/os_win.c 77d39873836f1831a9b0b91894fec45ab0e9ca8e067dc8c549e1d1eca1566fe9
 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
 F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
@@ -1886,7 +1886,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P aa2ee5754c9f8378c4d490ca756a6415042904477727f0d86e9c0190b5e8b275
-R 8b09c129b5616689dddf768a62867ed7
-U dan
-Z 7a4f3964eb07b9a4c17563a7fe83c3f9
+P 2c437f7a2c87129d00c71fa569315b68e0ba9514041d93503350c9ae9f080f17
+R 3991e5c25074cbb0d90849adccd287d5
+U drh
+Z 6d9d66ca2a393378f613e4c4179785fa
index 7134337870fb809fa5b3acf7e0119b8f28b1ade2..2b58cfdb6aa6a7a576e99d618c9ea78984348535 100644 (file)
@@ -1 +1 @@
-2c437f7a2c87129d00c71fa569315b68e0ba9514041d93503350c9ae9f080f17
\ No newline at end of file
+b45a08e3c7edfa76b699d3e29f28daa5bd08039668ec57121e4e85edf36150f1
\ No newline at end of file
index ee7ef26871cefd32b479e23766131ddf1550a9c5..a688ed2706e26a22f9e57b66ede58cc76de365b9 100644 (file)
@@ -6361,7 +6361,7 @@ static int unixBackupDir(const char *z, int *pJ){
   int j = *pJ;
   int i;
   if( j<=0 ) return 0;
-  for(i=j-1; i>0 && z[i-1]!='/'; i--){}
+  for(i=j-1; ALWAYS(i>0) && z[i-1]!='/'; i--){}
   if( z[i]=='.' && i==j-2 && z[i+1]=='.' ) return 0;
   *pJ = i-1;
   return 1;
@@ -6405,6 +6405,7 @@ static int mkFullPathname(
   }
   zOut[j] = 0;
 
+  assert( zOut[0]=='/' );
   for(i=j=0; zOut[i]; i++){
     if( zOut[i]=='/' ){
       /* Skip over internal "/." directory components */
@@ -6425,10 +6426,10 @@ static int mkFullPathname(
         continue;
       }
     }
-    if( j>=0 ) zOut[j] = zOut[i];
+    if( ALWAYS(j>=0) ) zOut[j] = zOut[i];
     j++;
   }
-  if( j==0 ) zOut[j++] = '/';
+  if( NEVER(j==0) ) zOut[j++] = '/';
   zOut[j] = 0;
   return SQLITE_OK;
 }