summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
Commit message (Collapse)AuthorAgeFilesLines
...
| * | * generic/tclStringObj.c: A few more string overflow cases indgp2009-08-271-3/+13
| | | | | | | | | | | | [format]. [Bug 2845535]
| * | * generic/tclStringObj.c: Corrected failure to grow bufferdgp2009-07-311-1/+4
| | | | | | | | | | | | | | | * tests/format.test: when format spec request large width floating point values. Thanks to Clemens Misch. [Bug 2830354]
| * | fix 64bit int <-> ptr cast warningsdas2009-07-151-2/+2
| | |
| * | Cast wide integer to int conversion and some signed/unsigned conversions. ↵patthoyts2009-07-011-3/+3
| | | | | | | | | | | | (silence msvc6 warnings)
| * | * generic/tclStringObj.c: sprintf() -> Tcl_ObjPrintf() conversion.dgp2009-06-151-5/+3
| | |
| * | * generic/tclStringObj.c: Revised [format] to not overflow thedgp2009-06-101-8/+68
| | | | | | | | | | | | | | | | | | | | | integer calculations computing the length of the %ll formats of really big integers. Also added protections so that [format]s that would produce results overflowing the maximum string length of Tcl values throw a normal Tcl error instead of a panic. [Bug 2801413]
| * | * generic/tclStringObj.c: AppendUnicodeToUnicodeRep failedcore_8_5_7dgp2009-04-151-1/+2
| | | | | | | | | | | | to set stringPtr->allocated to 0, leading to crashes.
| * | silence warning preventing symbols build with msvc6 (signed/unsigned comparison)patthoyts2009-04-101-2/+2
| | |
| * | * generic/tclStringObj.c (UpdateStringOfString): Fix bug detecteddgp2009-04-101-3/+3
| | | | | | | | | | | | by compiler warning about undefined "dst".
| * | * generic/tclStringObj.c: Completed backports of fixes fordgp2009-04-071-68/+112
| | | | | | | | | | | | [Bug 2494093] and [Bug 2553906].
| * | * generic/tclStringObj.c: Added protections from invalid memorydgp2009-03-301-1/+33
| | | | | | | | | | | | | | | | | | | | | * generic/tclTestObj.c: accesses when we append (some part of) * tests/stringObj.test: a Tcl_Obj to itself. Added the appendself and appendself2 subcommands to the [teststringobj] testing command and added tests to the test suite. [Bug 2603158]
| * | * generic/tclStringObj.c: Test stringObj-6.9 checks thatdgp2009-03-211-2/+8
| | | | | | | | | | | | | | | * tests/stringObj.test: Tcl_AppendStringsToObj() no longer crashes when operating on a pure unicode value. [Bug 2597185]
| * | * generic/tclStringObj.c: Added overflow protections to thedgp2009-02-051-4/+29
| | | | | | | | | | | | | | | AppendUtfToUtfRep routine to either avoid invalid arguments and crashes, or to replace them with controlled panics. [Bug 2561794]
| * | comment typodgp2009-02-041-2/+2
| | |
| * | * generic/tclStringObj.c (SetUnicodeObj): Corrected failure ofdgp2009-02-041-43/+28
| | | | | | | | | | | | | | | Tcl_SetUnicodeObj() to panic on a shared object. [Bug 2561488]. Also factored out common code to reduce duplication.
| * | * generic/tclStringObj.c (STRING_SIZE): Corrected failure to limitdgp2009-01-091-4/+7
| | | | | | | | | | | | | | | memory allocation requests to the sizes that can be supported by Tcl's memory allocation routines. [Bug 2494093].
| * | * generic/tclStringObj.c (STRING_UALLOC): Added missing parensdgp2009-01-081-2/+2
| | | | | | | | | | | | | | | required to get correct results out of things like STRING_UALLOC(num + append). [Bug 2494093].
| * | * generic/tclStringObj.c (Tcl_AppendFormatToObj):dgp2008-04-071-3/+3
| | | | | | | | | | | | | | | | | | Fix [format {% d}] so that it behaves the same way as in 8.4 and as C's printf(). * tests/format.test: Add a test for '% d' and '%+d'.
* | | * generic/tclZlib.c (Tcl_ZlibStreamGet): [Bug 3081008]: Ensure thatdkf2010-10-191-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when a bytearray gets its internals entangled with zlib for more than a passing moment, that bytearray will never be shimmered away. This increases the amount of copying but is simple to get right, which is a reasonable trade-off. * generic/tclStringObj.c (Tcl_AppendObjToObj): Added some special cases so that most of the time when you build up a bytearray by appending, it actually ends up being a bytearray rather than shimmering back and forth to string. * tests/http11.test (check_crc): Use a simpler way to express the functionality of this procedure.
* | | * generic/tclBinary.c (TclAppendBytesToByteArray): Add commentsdgp2010-04-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclInt.h (TclAppendBytesToByteArray): placing overflow protection responsibility on caller. Convert "len" argument to signed int which any value already vetted for overflow issues will fit into. * generic/tclStringObj.c: Update caller; standardize panic msg. * generic/tclBinary.c (UpdateStringOfByteArray): Add panic when the generated string representation would grow beyond Tcl's size limits. [Bug 2994924]
* | | * generic/tclBinary.c (TclAppendBytesToByteArray): [Bug 2992970]: Makedkf2010-04-291-4/+3
| | | | | | | | | | | | | | | | | | * generic/tclStringObj.c (Tcl_AppendObjToObj): an append of a byte array to another into an efficent operation. The problem was the (lack of) a proper growth management strategy for the byte array.
* | | * generic/tclStringObj.c: Fix array overrun in test format-1.12dgp2010-03-291-2/+2
| | | | | | | | | | | | caught by valgrind testing.
* | | Code Audit results:dkf2010-03-051-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | * use do { ... } while (0) in macros * avoid shadowing one local variable with another * use clearer 'foo.bar++;' instead of '++foo.bar;' where result not required (i.e., semantically equivalent) * follow Engineering Manual rules on spacing and declarations
* | | Pure whitespace changes, changing to follow Engineering Manual style.dkf2010-02-241-4/+4
| | |
* | | Ensure that objects are released in all cases (hard to test this particulardkf2010-01-181-1/+4
| | | | | | | | | | | | one without a very large system, but the leak path existed)
* | | [Bug 2932421]: Make [format] less likely to smash intreps.dkf2010-01-181-40/+48
| | |
* | | * generic/tclDictObj.c: Updated freeIntRepProc routines sodgp2009-09-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclExecute.c: that they set the typePtr field to * generic/tclIO.c: NULL so that the Tcl_Obj is not left * generic/tclIndexObj.c: in an inconsistent state. * generic/tclInt.h: [Bug 2857044] * generic/tclListObj.c: * generic/tclNamesp.c: * generic/tclOOCall.c: * generic/tclObj.c: * generic/tclPathObj.c: * generic/tclProc.c: * generic/tclRegexp.c: * generic/tclStringObj.c:
* | | * generic/tclStringObj.c: A few more string overflow cases indgp2009-08-271-3/+13
| | | | | | | | | | | | [format]. [Bug 2845535]
* | | * generic/tclStringObj.c: Corrected failure to grow bufferdgp2009-07-311-1/+4
| | | | | | | | | | | | | | | * tests/format.test: when format spec request large width floating point values. Thanks to Clemens Misch. [Bug 2830354]
* | | Fix [Bug 2637173] by consolidating bytearray purity check.dkf2009-07-121-18/+5
| | |
* | | Cast wide integer to int conversion (silence msvc6 warning)patthoyts2009-07-011-3/+3
| | |
* | | * generic/tclStringObj.c: sprintf() -> Tcl_ObjPrintf() conversion.dgp2009-06-151-5/+3
| | |
* | | * generic/tclStringObj.c: Revised [format] to not overflow thedgp2009-06-101-8/+69
| | | | | | | | | | | | | | | | | | | | | integer calculations computing the length of the %ll formats of really big integers. Also added protections so that [format]s that would produce results overflowing the maximum string length of Tcl values throw a normal Tcl error instead of a panic. [Bug 2801413]
* | | * generic/tclStringObj.c: Corrected failures to deal with thedgp2009-06-101-22/+10
| | | | | | | | | | | | | | | "pure unicode" representation of an empty string. Thanks to Julian Noble for reporting the problem. [Bug 2803109]
* | | * generic/tclStringObj.c: Correction so that value ofdgp2009-04-071-2/+2
| | | | | | | | | | | | TCL_GROWTH_MIN_ALLOC is everywhere expressed in bytes as comment claims.
* | | * generic/tclStringObj.c: Several revisions to the shimmeringdgp2009-02-221-17/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patterns between Unicode and UTF string reps. Most notably the call: objPtr = Tcl_NewUnicodeObj(...,0); followed by a loop of calls: Tcl_AppendUnicodeToObj(objPtr, u, n); will now grow and append to the Unicode representation. Before this commit, the sequence would convert each append to UTF and perform the append to the UTF rep. This is puzzling and likely a bug. The performance of [string map] is significantly improved by this change (according to the MAP collection of benchmarks in tclbench). Just in case there was some wisdom in the old ways that I missed, I left in the ability to restore the old patterns with a #define COMPAT 1 at the top of the file.
* | | alternative solution to the signed/unsigned warningsdgp2009-02-191-5/+5
| | |
* | | fix signed/unsigned comparison warningsdas2009-02-191-4/+4
| | |
* | | * generic/tclStringObj.c: Simplify the logic of thedgp2009-02-181-66/+31
| | | | | | | | | | | | Tcl_*SetObjLength() routines.
* | | another TODOdgp2009-02-181-1/+2
| | |
* | | * generic/tclStringObj.c: Rewrite GrowStringBuffer() so that itdgp2009-02-181-16/+23
| | | | | | | | | | | | | | | | | | | | | | | | has parallel structure with GrowUnicodeBuffer(). The revision permits allocation attempts to continue all the way up to failure, with no gap. It also directly manipulates the String and Tcl_Obj internals instead of inefficiently operating via Tcl_*SetObjLength() with all of its extra protections and underdocumented special cases.
* | | * generic/tclStringObj.c: Another round of simplification ondgp2009-02-181-21/+21
| | | | | | | | | | | | the allocation macros.
* | | * generic/tclStringObj.c: Another round of simplification ondgp2009-02-181-29/+25
| | | | | | | | | | | | the allocation macros.
* | | * generic/tclStringObj.c: Pare back the length of the unicodedgp2009-02-171-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | array in a non-extended String struct to one Tcl_UniChar, meant to hold the terminating NUL character. Non-empty unicode strings are then stored by extending the String struct by stringPtr->maxChars additional slots in that array with sizeof(Tcl_UniChar) bytes per slot. This revision makes the allocation macros much simpler.
* | | * generic/tclStringObj.c: Factor out common GrowUnicodeBuffer()dgp2009-02-171-44/+51
| | | | | | | | | | | | and solve overflow and growth algorithm fallbacks in it.
* | | * generic/tclStringObj.c: Factor out common GrowStringBuffer().dgp2009-02-171-150/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclStringObj.c: Convert Tcl_AppendStringsToObj into * tests/stringObj.test: a radically simpler implementation where we just loop over calls to Tcl_AppendToObj. This fixes [Bug 2597185]. It also creates a *** POTENTIAL INCOMPATIBILITY *** in that T_ASTO can now allocate more space than is strictly required, like all the other Tcl_Append* routines. The incompatibility was detected by test stringObj-6.5, which I've updated to reflect the new behavior.
* | | * generic/tclStringObj.c: Revise buffer growth implementationdgp2009-02-171-13/+32
| | | | | | | | | | | | | | | | | | | | | in ExtendStringRepWithUnicode. Use cheap checks to determine that no reallocation is necessary without cost of computing the precise number of bytes needed. Also make use of the string growth algortihm in the case of repeated appends.
* | | * generic/tclStringObj.c: Added protections from invalid memorydgp2009-02-161-4/+32
| | | | | | | | | | | | | | | | | | | | | * generic/tclTestObj.c: accesses when we append (some part of) * tests/stringObj.test: a Tcl_Obj to itself. Added the appendself and appendself2 subcommands to the [teststringobj] testing command and added tests to the test suite. [Bug 2603158]
* | | * generic/tclStringObj.c: Factor out duplicate code fromdgp2009-02-151-12/+4
| | | | | | | | | | | | Tcl_AppendObjToObj.
* | | * generic/tclStringObj.c: Replace the 'size_t uallocated' fielddgp2009-02-151-46/+42
| | | | | | | | | | | | | | | | | | | | | | | | of the String struct, storing the number of bytes allocated to store the Tcl_UniChar array, with an 'int maxChars' field, storing the number of Tcl_UniChars that may be stored in the allocated space. This reduces memory requirement a small bit, and makes some range checks simpler to code.