summaryrefslogtreecommitdiff
path: root/src/printf.c
AgeCommit message (Collapse)AuthorLines
7 daysRemove a harmless code redundancy and compiler warning left overdrh-1/+1
from [0c67cf34dc85f28e] FossilOrigin-Name: d19604f26492fee6c88facdb4be7bfae11bb396244d665bf444fd0892d163fdb
7 daysFix the format() function (and its related printf() routines) so thatdrh-11/+23
the alternate-form flag ("#") on hexadecimal and octal outputs includes the 0x, 0X, or 0 prefix as part of the total width. [bugs:/info/2026-11-05T22:14:37Z|Bug 2026-11-05T22:14:37Z] FossilOrigin-Name: 0c67cf34dc85f28e414e4a2c5a1417be9f1ad69886b211f65e56b08be45335f3
2026-11-05Fix an off-by-one error in an assert(). Harmless.drh-1/+1
[bugs:/info/2026-11-04T20:21:55Z|Bug 2026-11-04T20:21:55Z] FossilOrigin-Name: f1d2bab29a12a937c9015dfa169c5d9b027ffb8811cc567ef485e4898250b94f
2026-09-26Never let the SQLITE_FP_PRECISION_LIMIT exceed 100 million.drh-5/+10
[bugs:/info/2026-09-26T07:06:12Z|Bug 2026-09-26T07:06:12Z] FossilOrigin-Name: ba6f5fb7b8fa9b6862ef7bda64483942182e214a2fb13c6288c48762a0372fef
2026-08-26An attempt to make the authorizer effective at preventing the use ofdrh-4/+7
some functions within the DEFAULT clause of a table. FossilOrigin-Name: 321e41b09179acba59958bdd6b07e4b7d915b9c0dfca143e4914b3690692c201
2026-06-29Add new assert()s to help static analyzers realize that the code is correct.drh-0/+1
FossilOrigin-Name: 007f0496619e571092382a3668b6bbcc17919908895dc4be71f8d1b6ec2aeeed
2026-06-25Improve the sqlite3_str_vappendf() routine for additional robustness in thedrh-28/+60
face of over-sized inputs. Probable fix for [bugs:/info/2026-06-25T11:29:23Z|Bug 2026-06-25T11:29:23Z]. FossilOrigin-Name: d7e4b2a85f81dacfee497d806bbc9f8c262624bd618aa27d4d238191643a4f5d
2026-06-25Alternative to [15a6482300bb2804] that is testable.drh-1/+1
FossilOrigin-Name: 847e6a657451182be73816444c5e6f0e099dacf2cc8b99669e3b96f83dd51117
2026-06-24Defend against integer overflow on oversized string inputs todrh-1/+1
sqlite3_mprintf() and similar C-language interfaces when using the "%!.*s" conversion. The problem is not reachable from SQL due to string length restrictions in SQL. C-code is required. [bugs:/info/2026-06-24T11:57:36Z|Bug 2026-06-24T11:57:36Z]. FossilOrigin-Name: 15a6482300bb2804fbfad1f07d6d74da6c0cb5953d44b74bc61c17d29e29821c
2026-06-19Put the sqlite3OomStr singleton in "const" space to ensure that it isdrh-3/+5
never modified. Doing so identified a long-standing bug. FossilOrigin-Name: 2fe53e6d68c3f9f1c4b064fa40fe8efe12025179a973182f0bb256acb9b5d58d
2026-06-19Additional changes based on Claude analysis.drh-10/+0
FossilOrigin-Name: d4691a0db1e96b646d3094f183b1fc330411a2d2472b09f9b5fe0fb268b5ca09
2026-06-19Further refinements and uses for sqlite3_result_str().drh-16/+0
FossilOrigin-Name: 974253a6058a7120354261b2134ed4803373031996957c7334161370b80bf428
2026-05-31Fix the format() SQL function so that it reports TOOBIG and NOMEM errors.drh-2/+2
Fix a possible integer overflow on %#Q formatting. [bugs:/info/2026-05-31T02:00:07Z|Bug 2026-05-31T02:00:07Z]. FossilOrigin-Name: 3bfe0510aecccf113b9d008c308fca3096e9c45c59b919c0b91bb4703415988f
2026-05-17Fix the new %J and %j formats so they work correctly with a zero precision.drh-1/+2
FossilOrigin-Name: 428b924dd6e228c879338c5c5edbe68bdc4d8d8e80c37e3d070a8a34b57300c1
2026-05-07Remove unnecessary and incorrect assert() statements in the new %J code.drh-4/+0
FossilOrigin-Name: 5a8497dbec80b55a2dedc8a6f9ee823243e01a08d37ceeed1f87214dfe527d63
2026-05-07Fix harmless UB by declaring a constant 1 to be unsigned.drh-1/+1
FossilOrigin-Name: c5235734a6787b9c59a356f4e0ccbb3f262b8d9a6407ebd415afc87e859b0498
2026-05-07Fix another off-by-one error.drh-1/+1
FossilOrigin-Name: 8ae724a647dfcb986c4037caaab07e5d0188e66b66039a4758937c963f1fcbf7
2026-05-07Bug fixes in the new %J and %j logic.drh-10/+22
FossilOrigin-Name: d1b55572c76569cb1e999028e79bcf2e76069f8778f0c8e933ace606d7b6a8b2
2026-05-07Add support for width to %J and %j.drh-4/+22
FossilOrigin-Name: 0b102f2076586c08b134c78cc18acdd05555fa2b534c895535e96a0466661910
2026-05-07Separate conversion letters %J and %j. %J includes surrounding quotes anddrh-36/+39
%j omits them. Some test cases added. FossilOrigin-Name: ea7c2c1a6bd32695fc3a1f2295b4c4719e3d9dd0a8f6480e7c95e17b564c3391
2026-05-07Get precision working on %J, both with and with the ! flag. Width isdrh-2/+13
still a no-op, and there are no test cases. Incremental check-in. FossilOrigin-Name: 18166bce208c64b7f3afaa88c27a10e0295a89f9c72942dcaa949cf7efb479e6
2026-05-06Experimental prototype of the %J conversion in printf().drh-31/+72
FossilOrigin-Name: 7f6b1bae0849f0a840b95ae95aa6fdc6d51b72fdd50493649f584ad7829a3060
2026-04-15Bug fix in sqlite3_str_free(): Do not crash if called on an sqlite3_strdrh-1/+1
object returned from sqlite3_str_new() following an OOM. FossilOrigin-Name: 92d8ac0c4938e43b00111b43630ecfa91c30e5200ca03937a84f4b50bd1a13b3
2026-04-10Use sqlite3_malloc() for memory allocation inside of sqlite3_str_vappendf(),drh-2/+2
since it invokes sqlite3_initialize(), whereas sqlite3DbMallocRaw() does not. FossilOrigin-Name: a2f84c56316ea746c134aa6e5a2b46021f67c6642161beae8122f73daeddda92
2026-04-10Fix the printf() optimization added at [ccb6b6c4ac21742d] so thatdrh-12/+36
sqlite3_snprintf() does not incorrectly truncate floating-point conversions that are close to filling the buffer, as reported in [forum:/forumpost/2026-04-10T13:48:12z|forum post 2026-04-10T13:48:12z]. FossilOrigin-Name: a50521a16068e555aa08ee25726b081bb4cd33e3ea388b82dcbaa691c2576284
2026-04-08Fix a buffer overflow bug in a recent check-in, reported by unsolicteddrh-1/+1
email from OpenAI/Codex. FossilOrigin-Name: be891a137af15897691250324e4d3d9c96f0c5fb414bca27d0c3bfdd3012a8a2
2026-03-29Fix harmless compiler warnings about unused variable assignments.drh-2/+0
FossilOrigin-Name: afe7e9fd1c476c7cdcefab0adf0191a8dc3283811f72a685fff3eb6539b72dcc
2026-03-28In sqlite3_str_vappendf(), write floating-point renderings directly intodrh-30/+39
the output buffer, saving a memcpy(). FossilOrigin-Name: e4e040e7aaaf5bfccbf0414fee3d08c5fdc24e03d1118dce92d2dd16c614ce63
2026-03-25Performance optimization when zero-padding in printf().drh-3/+5
FossilOrigin-Name: dbd81abdc6633124e72999321db6fc8640851fa5eb063e6317a4c3e57b48dbaa
2026-03-25Signification optimizations to layout of text for floating pointdrh-6/+34
conversions in sqlite3_str_vappendf(). FossilOrigin-Name: 6a74df6d6ecfda8e0ff72ca0f4167190e989973ad124412892f7d36f1666ccfc
2026-02-20Inconsequential changes to floating-point conversion, amounting to meredrh-1/+1
code cleanup to aid comprehension. FossilOrigin-Name: 6d9c29123b6b143b0f7c8f5d018f170c72edfc5b1a4d67edd45e5552def2af6c
2025-11-17Fix a harmless compiler warning.drh-1/+1
FossilOrigin-Name: 6621737cc05cbf8ff5f576775a8a3c64f666b56d42939968ebb55d72a835646b
2025-11-14New interfaces sqlite3_str_truncate() and sqlite3_str_free(). Version numberdrh-0/+19
increases to 3.52.0. FossilOrigin-Name: fa85534ed927851dc37a4943e83259bff4509f141449226ffb506f9acc7b2cc5
2025-10-05Another small performance increase in the text format by using strchr() todrh-1/+4
search for '%'. FossilOrigin-Name: 59ad89ba07dd7b127f03f62a647f7328f08dbc0aa1b88b2b4529eb5b4c677775
2025-10-05Fix a syntax error in the tcl script part of [199b6567bb41cd].stephan-7/+6
FossilOrigin-Name: a7ed85f27066b74263dbd3dfcefe5d378e524cc56cd3abac4032bc23f83b5d21
2025-10-05Performance optimization in text formatter by using a hash table to look updrh-32/+68
the operator character that follows %-subsitutions. FossilOrigin-Name: 199b6567bb41cd41977e28b3e06e8c26c3300b3873f226a4699ec251a7bf8883
2025-07-30Enhance the printf formatter for %#f such that the minus sign is omitteddrh-1/+15
if the '+' is missing and all digits shown in the rendering are zero. Thus, for example, '%#.2f' renders -0.004 as "0.00" instead of "-0.00". FossilOrigin-Name: 09e1d7c7b4615262dd03adf1be201122f3cb8909ad381d67f51c812f07e25719
2025-06-16Make the show-%p-az-zero hack of the previous check-in configurable atdrh-6/+5
run-time using the 0x100000 bit of either .treetrace or .wheretrace. As before, this is all a no-op except for debugging builds. FossilOrigin-Name: a29627d7e7f8344d9a099cc133bda85250b02dc5ee5f358ba59691e0816b5b2d
2025-06-16Add an "#if 0" that can be changed to "1" to cause all %p output to renderdrh-0/+9
as 0, thus making comparisons of .treetrace and .wheretrace output easier. FossilOrigin-Name: 65e2704c0bc329f3dd248548a2d4edb7d3ace8ceaf0b82b8618b9b1b764884cd
2025-04-17Increase the size of the output buffer for sqlite3_log().drh-1/+10
FossilOrigin-Name: a64e8491c9863f890daa9f5d8f678728dc0d00bc1f3c238b50214ec545450fcf
2025-03-02Ensure that detection of control characters by comparison against 0x1fdrh-2/+2
uses unsigned characters. [forum:/forumpost/4c344ca61f|Forum post 4c344ca61f]. FossilOrigin-Name: b7c5ce84216cc7f5a3ba07404572edb94fd628b3a7421111cd5f5333f3e56ea8
2025-02-25Small performance improvement for the new %#Q conversion in printf.drh-13/+17
FossilOrigin-Name: 17e440781e68d7d3ea68c5144e1e08e183f0caef595a6c7ac4ce56489c60f476
2025-02-25Consolidate two different UTF8 encoders into a single subroutine.drh-19/+1
FossilOrigin-Name: 6208e494858b9d362efc7db4e8aac6f8e93fe51d2e038c94dfa97c55a74688a0
2025-02-23The %#Q conversion now adds unistr('...') around the converted string ifdrh-26/+59
escape characters were inserted. %#w now works just like %w as escape sequences inside of identifiers are not recognized. FossilOrigin-Name: 997391d42079783e294836f714ccd9526ecc442c8dbf8212d72cd17c67e7158a
2025-02-23Enhance the %Q, %q, and %w printf conversions so that if the alternate-formdrh-1/+24
flag # is present, they transform backslash and control characters into unistr()-style backslash escape codes. FossilOrigin-Name: ffbfcc2bbb57f02aa5ee813e7a25a2a014e3353a10f6bccb609075a5b63545d7
2025-02-17Code changes that make it easier to prove that no 32-bit integer overflowsdrh-1/+1
happen during memory allocation. No problems fixed; this change is just to make future maintenance easier. FossilOrigin-Name: 215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5
2024-11-20Do not report an sqlite3_error_offset() for errors that occur inside ofdrh-0/+1
views or triggers, since the text of those elements is not part of the original query. FossilOrigin-Name: bf66c6dfc25c2562a4e6a5b24dd1660213a8fefbb5763e7583b87fb06dbaaf43
2024-08-20Remove unreachable code.drh-3/+1
FossilOrigin-Name: 17699329aa8e234c6793a38db5ca05def9395b287bcc8bc05493b824327edb59
2024-08-19Refactor the SrcItem object so that information about subqueries is storeddrh-4/+9
in a separately allocated Subquery object. This reduces the memory requirements for SrcItem and makes the code run faster. It also provides an expansion path for subquery processing that does not burden simple queries. The current checking mostly works, but there are still issues that need to be tracked down and fixed. FossilOrigin-Name: 8ff5dda8448d7e1a533d7f27db2573ce68fa9956b9d9847ced45e83c1f06bab0
2024-08-17Give unique names to fields in the SrcItem object, to facilitate analysis ofdrh-1/+1
how those fields are used using "grep". FossilOrigin-Name: 9f5aeef3cbc2c95267c8f7bf60d5c66971a76789669fb0e8f853273ff6f616f2