#227 lsx_parsesamples() bug

closed-fixed
nobody
None
5
2012-12-15
2012-12-15
nu774
No

author Ulrich Klauer <ulrich@chirlu.de>
Sun, 14 Oct 2012 19:34:14 +0000 (21:34 +0200)
committer Ulrich Klauer <ulrich@chirlu.de>
Sun, 14 Oct 2012 19:34:14 +0000 (21:34 +0200)

By the above commit, time format parsing fails for valid time spec due to the following bug.

+ if (strchr("+-", *str))
+ combine = *str++;
+ else combine = '\0';

This code is *meant* to check if *str is '+' or '-'.
However, when str points to the nul terminater here, strchr() doesn't return NULL and str is wrongly incremented beyond nul terminater
(please consult spec of strchr(s,c), It works like that when c == 0).

Discussion

  • Ulrich Klauer
    Ulrich Klauer
    2012-12-15

    Thank you for pointing this out. lsx_parsesamples even failed the tests now, so either I didn't re-test after some changes, or there happened to be some zero-padding after the test strings.
    Added a test case (string containing an explicit NUL) to always catch this in the future.

     
  • Ulrich Klauer
    Ulrich Klauer
    2012-12-15

    • status: open --> closed-fixed