Brad Fitzpatrick (bradfitz) wrote in lj_dev,
Brad Fitzpatrick
bradfitz
lj_dev

I suck.

Sorry for wasting many people's time that would have otherwise been spent sleeping.

This fixes the infinite loop that was eating up CPU and memory and crashing machines when they ran out of swap.

I wasn't trusting user input here ... I already validated their opts at another place, but in this case $q->{'opts'} was NULL, which is mapped to "undef" by DBI, so from, to, and by were all zero in numeric context. I got paranoid though and added the $by > 0 and int($by) checks... all that should be necessary is unless ($by).

--- ljpoll.pl.orig	Sat May 19 12:13:02 2001
+++ ljpoll.pl	Sat May 19 12:02:10 2001
@@ -549,6 +549,7 @@
 	    ## manually add all the possible values, since they aren't in the database
 	    ## (which was the whole point of making a "scale" type):
 	    my ($from, $to, $by) = split(m!/!, $q->{'opts'});
+	    $by = 1 unless ($by > 0 and int($by) == $by);
 	    for (my $at=$from; $at<=$to; $at+=$by) {
 		push @{$its{$qid}}, [ $at, $at ];  # note: fake itemid, doesn't matter, but needed to be unique
 	    }
Subscribe

  • cl-journal livejournal client

    Hey everyone, I'd like to present a livejournal client that I wrote to fulfill my needs but maybe there are other people that can find it…

  • SessionGenerate and ljloggedin

    Are there any information after release 86 and changes in cookies scheme to use sessiongenerate? It returns ljsession key, but this key is not enough…

  • Retrieving comments

    Hi, Is there a way to retrieve a list of comments made by user XXX (which may or may be not the currently logged in user) in the journals of users…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 15 comments

  • cl-journal livejournal client

    Hey everyone, I'd like to present a livejournal client that I wrote to fulfill my needs but maybe there are other people that can find it…

  • SessionGenerate and ljloggedin

    Are there any information after release 86 and changes in cookies scheme to use sessiongenerate? It returns ljsession key, but this key is not enough…

  • Retrieving comments

    Hi, Is there a way to retrieve a list of comments made by user XXX (which may or may be not the currently logged in user) in the journals of users…