mirror of
https://github.com/sqlite/sqlite.git
synced 2026-10-28 09:46:20 +08:00
For the "relaxed" quoting mode of QRF, tighten the restrictions on what
must be quoted to help prevent strings that actually look like numbers from going unquoted. [bugs:/info/2026-10-24T04:41:27Z|Bug 2026-10-24T04:41:27Z] FossilOrigin-Name: 7c8c79a443e025f32035ec91d8c32e032996f1b798444b5b1b5ce98d759f1338
This commit is contained in:
1 parent
9410bfb946
commit
c6536c6e60
4 files changed
+93
-15
No files matched your search
+15
-7
@@ -861,15 +861,23 @@ static int qrfRelaxable(Qrf *p, const char *z){
|
||||
if( p->spec.zNull && strcmp(p->spec.zNull,z)==0 ) return 0;
|
||||
i = (z[0]=='-' || z[0]=='+');
|
||||
if( strcmp(z+i,"Inf")==0 ) return 0;
|
||||
if( !qrfDigit(z[i]) ) return 1;
|
||||
i++;
|
||||
if( z[i]=='0' && (z[i+1]=='x' || z[i+1]=='X') ){
|
||||
/* Hexadecimal integer literal: 0x1f */
|
||||
i += 2;
|
||||
n = strspn(&z[i], "0123456789abcdefABCDEF");
|
||||
return n==0 || z[i+n]!=0;
|
||||
}
|
||||
if( z[i]=='.' && qrfDigit(z[i+1]) ){
|
||||
/* Real literal with no digits before the ".", such as ".5" */
|
||||
i++;
|
||||
}else if( !qrfDigit(z[i]) ){
|
||||
return 1;
|
||||
}else{
|
||||
while( qrfDigit(z[i]) ){ i++; }
|
||||
if( z[i]=='.' ) i++;
|
||||
}
|
||||
while( qrfDigit(z[i]) ){ i++; }
|
||||
if( z[i]==0 ) return 0;
|
||||
if( z[i]=='.' ){
|
||||
i++;
|
||||
while( qrfDigit(z[i]) ){ i++; }
|
||||
if( z[i]==0 ) return 0;
|
||||
}
|
||||
if( z[i]=='e' || z[i]=='E' ){
|
||||
i++;
|
||||
if( z[i]=='+' || z[i]=='-' ){ i++; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
C Use\s64-bit\smath\sto\savoid\sinteger\soverflow\sin\sunixSleep()\son\sthe\srare\nsystems\sthat\slack\sboth\susleep()\sand\snanosleep().\n[bugs:/info/2026-10-24T09:43:25Z|Bug\s2026-10-24T09:43:25Z]
|
||||
D 2026-10-24T14:54:49.869
|
||||
C For\sthe\s"relaxed"\squoting\smode\sof\sQRF,\stighten\sthe\srestrictions\son\swhat\nmust\sbe\squoted\sto\shelp\sprevent\sstrings\sthat\sactually\slook\slike\snumbers\nfrom\sgoing\sunquoted.\n[bugs:/info/2026-10-24T04:41:27Z|Bug\s2026-10-24T04:41:27Z]
|
||||
D 2026-10-24T15:10:50.142
|
||||
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
@@ -427,7 +427,7 @@ F ext/misc/zipfile.c 842a31a19997cd53da5ae1920d783e3032ad34eecb5da91bc483ae5b551
|
||||
F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee
|
||||
F ext/qrf/README.md 394a70c5cda1d0f57c82434751b0174a594b1c8800c8584fad6091e867cd5a90
|
||||
F ext/qrf/dev-notes.md e68a6d91ce4c7eb296ef2daadc2bb79c95c317ad15b9fafe40850c67b29c2430
|
||||
F ext/qrf/qrf.c e2dd40a06b68da9c64cdc2fa35ba07e7e70edb0e103e968ce9404fe003d43388
|
||||
F ext/qrf/qrf.c 7a66d65194d104aba8d0684067ac57b4cd894c3881878af2835d7e0a1839ce2e
|
||||
F ext/qrf/qrf.h b04e50048695aa4a5a41577fb4a56c1feed0bef816354995713116780a4bdacb
|
||||
F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8
|
||||
F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255
|
||||
@@ -1539,7 +1539,7 @@ F test/mmapcorrupt.test 470fb44fe92e99c1d23701d156f8c17865f5b027063c9119dcfdb842
|
||||
F test/mmapfault.test d4c9eff9cd8c2dc14bc43e71e042f175b0a26fe3
|
||||
F test/mmapleak.test 7542cafa4771abba531d072ea905f474a2875a153337a04f327f0a9319cdb72c
|
||||
F test/mmapwarm.test 2272005969cd17a910077bd5082f70bc1fefad9a875afec7fc9af483898ecaf3
|
||||
F test/modeA.sql eef62974043e90d9d13b3f6921b94f35c008239bf41531432d6e82369b792bbd
|
||||
F test/modeA.sql 36c366badb91f37719ab302c57fbccf8cdb621937856596820e62ac566d13f11
|
||||
F test/multiplex.test d74c034e52805f6de8cc5432cef8c9eb774bb64ec29b83a22effc8ca4dac1f08
|
||||
F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a
|
||||
F test/multiplex3.test fac575e0b1b852025575a6a8357701d80933e98b5d2fe6d35ddaa68f92f6a1f7
|
||||
@@ -2300,8 +2300,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
|
||||
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
|
||||
P a5261fd58070d4cb10c627e54491ed7588d96f47073b19612aa669f684e8e5b5
|
||||
R b0ab9e87deeb2a167c99641f1b3ff24b
|
||||
P 458351f9725a423bba4672b83c3f1fd446de2559f416b3877514a0ccb8d4df0e
|
||||
R 46cabcdcb89f3a6a1143bb0dec318482
|
||||
U drh
|
||||
Z a9a1e1ce16596a6b93e048312922a956
|
||||
Z b68768be52beeb00d0e55ab3384aa851
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
+1
-1
@@ -1 +1 @@
|
||||
458351f9725a423bba4672b83c3f1fd446de2559f416b3877514a0ccb8d4df0e
|
||||
7c8c79a443e025f32035ec91d8c32e032996f1b798444b5b1b5ce98d759f1338
|
||||
@@ -757,3 +757,73 @@ INSERT INTO t VALUES(0.30000000000000004);
|
||||
INSERT INTO t VALUES(123456789.12345679);
|
||||
COMMIT;
|
||||
END
|
||||
|
||||
# Bug 2026-10-24T04:41:27Z
|
||||
#
|
||||
# Relaxed quoting must quote text values that look like real literals
|
||||
# with no digits before the "." and text values that look like
|
||||
# hexadecimal integer literals.
|
||||
#
|
||||
.open :memory:
|
||||
.mode tty
|
||||
.testcase 1600
|
||||
SELECT '.5' AS a, '0.5' AS b, 0.5 AS c, '-.5' AS d, '0x10' AS e, 0x10 AS f;
|
||||
.check <<END
|
||||
╭──────┬───────┬─────┬───────┬────────┬────╮
|
||||
│ a │ b │ c │ d │ e │ f │
|
||||
╞══════╪═══════╪═════╪═══════╪════════╪════╡
|
||||
│ '.5' │ '0.5' │ 0.5 │ '-.5' │ '0x10' │ 16 │
|
||||
╰──────┴───────┴─────┴───────┴────────┴────╯
|
||||
END
|
||||
.testcase 1610
|
||||
CREATE TABLE t2(a,b);
|
||||
INSERT INTO t2(a,b) VALUES
|
||||
(1,'.5'),
|
||||
(1,'-.5'),
|
||||
(1,'+.5'),
|
||||
(1,'.5e3'),
|
||||
(1,'.5E-3'),
|
||||
(1,'5.'),
|
||||
(0,'.'),
|
||||
(0,'-.'),
|
||||
(0,'.e5'),
|
||||
(0,'.5.5'),
|
||||
(0,'.5x'),
|
||||
(0,'.5e'),
|
||||
(1,'0x1F'),
|
||||
(1,'0X1f'),
|
||||
(1,'-0x10'),
|
||||
(1,'+0xabcdef'),
|
||||
(0,'0x'),
|
||||
(0,'0x1G'),
|
||||
(0,'0x1.5'),
|
||||
(0,'x10'),
|
||||
(0,'1x10');
|
||||
SELECT if(a,'yes','') AS 'quoted?', b AS string FROM t2 ORDER BY rowid;
|
||||
.check <<END
|
||||
╭─────────┬─────────────╮
|
||||
│ quoted? │ string │
|
||||
╞═════════╪═════════════╡
|
||||
│ yes │ '.5' │
|
||||
│ yes │ '-.5' │
|
||||
│ yes │ '+.5' │
|
||||
│ yes │ '.5e3' │
|
||||
│ yes │ '.5E-3' │
|
||||
│ yes │ '5.' │
|
||||
│ │ . │
|
||||
│ │ -. │
|
||||
│ │ .e5 │
|
||||
│ │ .5.5 │
|
||||
│ │ .5x │
|
||||
│ │ .5e │
|
||||
│ yes │ '0x1F' │
|
||||
│ yes │ '0X1f' │
|
||||
│ yes │ '-0x10' │
|
||||
│ yes │ '+0xabcdef' │
|
||||
│ │ 0x │
|
||||
│ │ 0x1G │
|
||||
│ │ 0x1.5 │
|
||||
│ │ x10 │
|
||||
│ │ 1x10 │
|
||||
╰─────────┴─────────────╯
|
||||
END
|
||||
Reference in new issue
Block a user