1. 18 4月, 2012 10 次提交
  2. 17 4月, 2012 12 次提交
    • R
      avoid null pointer dereference on %*p fields in scanf · 03de77f5
      Rich Felker 提交于
      03de77f5
    • R
      also ensure that write buffer is bounded when __stdio_write returns · b7a27617
      Rich Felker 提交于
      assuming other code is correct, this should be a no-op, but better to
      be safe...
      b7a27617
    • R
      fix buffer overflow in vfprintf on long writes to unbuffered files · b5a8b289
      Rich Felker 提交于
      vfprintf temporarily swaps in a local buffer (for the duration of the
      operation) when the target stream is unbuffered; this both simplifies
      the implementation of functions like dprintf (they don't need their
      own buffers) and eliminates the pathologically bad performance of
      writing the formatted output with one or more write syscalls per
      formatting field.
      
      in cases like dprintf where we are dealing with a virgin FILE
      structure, everything worked correctly. however for long-lived files
      (like stderr), it's possible that the buffer bounds were already set
      for the internal zero-size buffer. on the next write, __stdio_write
      would pick up and use the new buffer provided by vfprintf, but the
      bound (wend) field was still pointing at the internal zero-size
      buffer's end. this in turn allowed unbounded writes to the temporary
      buffer.
      b5a8b289
    • R
      fix %lf, etc. with printf · cc3a4466
      Rich Felker 提交于
      the l prefix is redundant/no-op with printf, since default promotions
      always promote floats to double; however, it is valid, and printf was
      wrongly rejecting it.
      cc3a4466
    • R
      better description for errno==0 · 9d2a15a6
      Rich Felker 提交于
      9d2a15a6
    • R
      implement wcstod and family · f94cbdeb
      Rich Felker 提交于
      not heavily tested but these functions appear to work correctly
      f94cbdeb
    • R
      avoid hitting eof in wcstol · a4310aa2
      Rich Felker 提交于
      shunget cannot unget eof status, causing wcstol to leave endptr
      pointing to the wrong place when scanning, for example, L"0x". cheap
      fix is to make the read function provide an infinite stream of bogus
      characters rather than eof. really this is something of a design flaw
      in how the shgetc system is used for strto* and wcsto*; in the long
      term, I believe multi-character unget should be scrapped and replaced
      with a function that can subtract from the f->shcnt counter.
      a4310aa2
    • R
    • R
      new scanf implementation and corresponding integer parser/converter · 18efeb32
      Rich Felker 提交于
      advantages over the old code:
      - correct results for floating point (old code was bogus)
      - wide/regular scanf separated so scanf does not pull in wide code
      - well-defined behavior on integers that overflow dest type
      - support for %[a-b] ranges with %[ (impl-defined by widely used)
      - no intermediate conversion of fmt string to wide string
      - cleaner, easier to share code with strto* functions
      - better standards conformance for corner cases
      
      the old code remains in the source tree, as the wide versions of the
      scanf-family functions are still using it. it will be removed when no
      longer needed.
      18efeb32
    • R
      fix buggy limiter handling in shgetc · cc762434
      Rich Felker 提交于
      this is needed for upcoming new scanf
      cc762434
    • R
      0d5df2df
    • R
      fix crash in wordfree if we_offs is not initialized by the caller · bef7a85e
      Rich Felker 提交于
      I'm not sure if it's legal for wordexp to modify this field, but this
      is the only easy/straightforward fix, and applications should not
      care. if it's an issue, i can work out a different (but more complex)
      solution later.
      bef7a85e
  3. 16 4月, 2012 4 次提交
  4. 15 4月, 2012 1 次提交
    • R
      fix signedness error handling invalid multibyte sequences in regexec · b9dd43db
      Rich Felker 提交于
      the "< 0" test was always false due to use of an unsigned type. this
      resulted in infinite loops on 32-bit machines (adding -1U to a pointer
      is the same as adding -1) and crashes on 64-bit machines (offsetting
      the string pointer by 4gb-1b when an illegal sequence was hit).
      b9dd43db
  5. 14 4月, 2012 3 次提交
    • R
      rename __sa_restorer to sa_restorer in struct sigaction · 0115a6ed
      Rich Felker 提交于
      this is legal since sa_* is in the reserved namespace for signal.h,
      per posix. note that the sa_restorer field is not used anywhere, so
      programs that are trying to use it may still break, but at least
      they'll compile. if it turns out such programs actually need to be
      able to set their own sa_restorer to function properly, i'll add the
      necessary code to sigaction.c later.
      0115a6ed
    • R
      remove invalid code from TRE · 386b34a0
      Rich Felker 提交于
      TRE wants to treat + and ? after a +, ?, or * as special; ? means
      ungreedy and + is reserved for future use. however, this is
      non-conformant. although redundant, these redundant characters have
      well-defined (no-op) meaning for POSIX ERE, and are actually _literal_
      characters (which TRE is wrongly ignoring) in POSIX BRE mode.
      
      the simplest fix is to simply remove the unneeded nonstandard
      functionality. as a plus, this shaves off a small amount of bloat.
      386b34a0
    • R
      fix broken regerror (typo) and missing message · b6dbdc69
      Rich Felker 提交于
      b6dbdc69
  6. 13 4月, 2012 3 次提交
  7. 12 4月, 2012 7 次提交