Skip to content
Tcl Source Code History Of Ticket 1259431fffffffffffffffffffffffffffffffff
Login

History Of Ticket 1259431fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 1259431fffffffffffffffffffffffffffffffff

  1. Ticket change [1fccfc45e9] (rid 91207) by mdejong on 2005-08-15 01:03:29:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      I ran into a little problem where a bug in code to call
      ckalloc ended up trying to allocate 0 bytes. That
      crashed in the Win32 malloc when compiled with
      Mingw. I can't see any reason to allow a zero byte
      allocation, and it seems like adding a test like the
      following could not hurt. Any objections?
      
      --- generic/tclCkalloc.c        19 Jan 2003 07:21:18
      -0000      1.19
      +++ generic/tclCkalloc.c        15 Aug 2005 00:59:24 -0000
      @@ -373,6 +373,10 @@
           if (validate_memory)
               Tcl_ValidateAllMemory (file, line);
      
      +    if (size == 0) {
      +        panic("attempt to ckalloc 0 bytes, %s line
      %d", size, file, line);
      +    }
      +
           result = (struct mem_header *)
      TclpAlloc((unsigned)size +
                                     sizeof(struct
      mem_header) + HIGH_GUARD_SIZE);
           if (result == NULL) {
      
      
    4. foundin initialized to: "None"
    5. priority initialized to: "2"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "mdejong"
    9. subsystem initialized to: "41. Memory Allocation"
    10. title initialized to: "Check for 0 byte allocation in ckalloc"
    11. type initialized to: "Patch"
  2. Ticket change [1ffb3fea7b] (rid 91234) by mdejong on 2005-08-15 08:03:29:

    1. icomment:
      
      
      File Added - 145666: ckalloc.patch
      
      
      
    2. login: "mdejong"
    3. mimetype: "text/plain"
    4. username: "mdejong"
  3. Add attachment "ckalloc.patch" [315aa588d8] (rid 93414) by mdejong on 2005-08-15 08:03:29.

  4. Ticket change [3e8e8d281a] (rid 121290) by mistachkin on 2005-08-15 08:33:55:

    1. icomment:
      Logged In: YES 
      user_id=113501
      
      I don't think we should take this patch, it breaks
      compatibility with malloc(), which is technically allowed to
      allocate a "zero byte item" and return it.
      
      The ANSI C standard states that this is "implementation
      defined"; however, we should probably just treat it as a one
      byte request.
      
      
      
    2. login: "mistachkin"
    3. mimetype: "text/plain"
    4. username: "mistachkin"
  5. Ticket change [ad11bedadc] (rid 101407) by dkf on 2005-08-15 22:03:30:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      The core currently checks (in Tcl_Alloc()) to see whether a
      NULL low-level alloc result is coming from asking for zero
      bytes; if so, it *doesn't* panic. This indicates that
      panic-ing on zero-alloc is probably wrong.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  6. Ticket change [cf1e89c3d3] (rid 112910) by hobbs on 2005-08-16 00:19:21:

    1. priority changed to: "4"
  7. Ticket change [60f3b9d7e1] (rid 92158) by hobbs on 2005-08-16 00:19:22:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      We certainly shouldn't panic on 0 alloc requests - that is
      perfectly valid in the C standard.  I see where Mo is
      requesting the patch we do seem to have a latent bug in that
      we shouldn't panic on (result == NULL) unless (size != 0),
      as AIX and some other systems do return NULL for 0-byte allocs.
      
      If a crash occured in the mingw compile, than I would
      backtrack to the sources making the alloc, as
      ckalloc(0)/malloc(0) is valid C.  We did have to correct
      code in tkImg*.c once regarding this (0 size image allocs)
      because we simply weren't handling the case of such requests
      - which was a bug in the image code, not in ckalloc(0) per se.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  8. Ticket change [14ef48dae1] (rid 124477) by hobbs on 2005-10-05 07:01:18:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      OK, this is the DB routines, and result == NULL panic is OK
      because we add guard bytes.  IOW, if we don't get mem, we
      don't have any to get ....
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. resolution changed to: "Wont Fix"
    5. status changed to: "Pending"
    6. username: "hobbs"
  9. Ticket change [3c066bd949] (rid 120847) by hobbs on 2005-10-05 07:01:19:

    1. closedate changed to: "2005-10-05T00:01:19"
    2. closer changed to: "hobbs"
  10. Ticket change [f43188c42e] (rid 129867) by sf-robot on 2005-10-19 09:20:53:

    1. closedate changed to: "2005-10-19T02:20:53"
    2. closer changed to: "sf-robot"
    3. icomment:
      Logged In: YES 
      user_id=1312539
      
      This Tracker item was closed automatically by the system. It was
      previously set to a Pending status, and the original submitter
      did not respond within 14 days (the time period specified by
      the administrator of this Tracker).
      
      
    4. login: "sf-robot"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "sf-robot"