[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] a memory issue; mildly scaring to me

From: Jörg F . Wittenberger
Subject: Re: [Chicken-users] a memory issue; mildly scaring to me
Date: 26 Sep 2011 15:16:07 +0200

While it does not fix the problem at hand:

There is a suspicious line in regex-core.scm 2222:

it reads:

   (printing or graphic whitespace)

IMHO it should read:

   (printing . (or graphic whitespace))

BTW: I know that those are the same.  It's just confusing the reader,
when the same list is written both styles.

Since the valgrind hints point into the initialization, I'm actually
reading the code.  :-/

There is more inconsistency to report, which too pertains to the original
rrregex source:

In sre-named-definitions there is exactly one entry, which obviously
has a procedure in the cdr:

(escape . ,(lambda (esc . o) `(* (or (~ ,esc ,@o) (seq ,esc any)))))

Since I do not fully understand the code, I don#t know what the intention

However the uses are not too many and hint towards possible errors:

line 1714 in the original 1816 in the chicken/irregex-core:
                ((assq (car sre) sre-named-definitions)
                 => (lambda (cell)
                      (lp (apply (cdr cell) (cdr sre)) n lo hi return)))

This one looks compatible with the escape procedure.

Line 1728 resp. 1830:

(let ((cell (assq sre sre-named-definitions)))
          (if cell
              (lp (if (procedure? (cdr cell)) ((cdr cell)) (cdr cell))
                  n lo hi return)

This one should produce a missing parameter.

Ah: since parameter checking might be off in the chicken core (is it?),
what would happen, if we use a parameter, which has not been passed?
Might that be the uninitialized value from a stack allocation, which
I see from valgrind?

2301/2404, same possible miss.

2421/2523: again signature compatible.


        (let ((cell (assq sre sre-named-definitions)))
          (if cell
              (rec (cdr cell))

loops into sre->procedure, which should IMHO default ince there's no
case for procedures.

The final one line(s) 3481/3589 should also raise an error.

What should be done?

Best regards


reply via email to

[Prev in Thread] Current Thread [Next in Thread]