Bug 407301 - Fix a bug that inhibited utf8-optimization in regcomp.c.
Summary: Fix a bug that inhibited utf8-optimization in regcomp.c.
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL: http://git.sv.gnu.org/gitweb/?p=gnuli...
Depends On:
TreeView+ depends on / blocked
Reported: 2007-12-01 14:56 UTC by Jim Meyering
Modified: 2016-11-24 16:05 UTC (History)
2 users (show)

Clone Of:
Last Closed: 2007-12-12 20:08:33 UTC

Attachments (Terms of Use)
s/idx/ctx_type/ (800 bytes, patch)
2007-12-01 14:56 UTC, Jim Meyering
no flags Details | Diff

Description Jim Meyering 2007-12-01 14:56:15 UTC
Description of problem: used-uninitialized bug inhibits utf8-optimization in
regex-compilation code

Version-Release number of selected component (if applicable): glibc-2.7-2

How reproducible: always

Steps to Reproduce: valgrind -q /usr/bin/ptx
Actual results:
    $ valgrind -q /usr/bin/ptx
    ==15740== Conditional jump or move depends on uninitialised value(s)
    ==15740==    at 0x410C67: (within /usr/bin/ptx)
    ==15740==    by 0x41118A: (within /usr/bin/ptx)
    ==15740==    by 0x401E4F: (within /usr/bin/ptx)
    ==15740==    by 0x40481A: (within /usr/bin/ptx)
    ==15740==    by 0x3C5081E073: (below main) (libc-start.c:220)

    $ valgrind ./ptx -S 'a$'
    ==15467== Conditional jump or move depends on uninitialised value(s)
    ==15467==    at 0x40C800: optimize_utf8 (regcomp.c:1054)
    ==15467==    by 0x40BF7B: re_compile_internal (regcomp.c:807)
    ==15467==    by 0x40AF52: rpl_re_compile_pattern (regcomp.c:236)
    ==15467==    by 0x401B86: compile_regex (ptx.c:419)
    ==15467==    by 0x401C77: initialize_regex (ptx.c:464)
    ==15467==    by 0x405149: main (ptx.c:2160)

Expected results:

no error

Additional info:

Comment 1 Jim Meyering 2007-12-01 14:56:15 UTC
Created attachment 274691 [details]

Comment 2 Jim Meyering 2007-12-12 19:53:32 UTC
FYI, I went back and did exactly the same things as before, but now, everything
works fine.  So I suspect that valgrind was lying (it was rawhide, after all).

Comment 3 Jakub Jelinek 2007-12-12 20:08:33 UTC
Actually, there is a minor code difference, one uses signed comparison, one
unsigned, similarly to e.g.:
unsigned int x;
void foo (void)
  switch (x)
    case 16:
      foo1 ();
    case 32:
      foo2 ();
    case 64:
      foo3 ();
    case 128:
      foo4 ();
with -O2 vs. -O2 -Dunsigned=
That doesn't make any difference though, the comparison is there only to divide
the range for positive matches into two halves.
Anyway, Uli checked the change in and it will be in glibc-2.7.90-1.

Note You need to log in before you can comment on or make changes to this bug.