Hylafax Developers Mailing List Archives

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

[hylafax-devel] Problem with fxStr [] operator and crackArg



Hi,

I have found possibly two seperate issues...

I have a custom "NotifyCmd" in my /var/spool/fax/etc/config file because
I am running the Calgary, Canada TPC cell.

NotifyCmd: 		"/usr/local/tpc/tpcnotify.pl"

When I try to start up the new faxq ( latest CVS ) , I am getting an 
Assertion error in Str.h.

The line can be traced to crackArgv (faxQueueApp.c++) at....

        while (s[i] && !isspace(s[i])) {
            i++;
        }

and the error is being caused in Str.h ( Line 120 ):

    char& operator[](int i) const                            
    {                                                        
        fxAssert((u_int)(i)<slength-1,"Invalid Str[] index");
        return data[i]; 
    }

What is basically happening is the while loops is going through until the
NULL character @ the end of the string.  The [] operator is giving an error
when the LAST character in the string is trying to be retrieved...

I think the code in the [] is wrong, in that AT THE MINIUMUM, it should 
be changed so that the LAST character can be accessed without an error..
( slength is the length of the string INCLUDING the NULL @ the end )

        fxAssert((u_int)(i)<slength,"Invalid Str[] index");
                                  ^^
				  |--- no -1 so it will work on last char..

The question remains, should the [] operator be allowed to return the '\0'
that is @ the end of the string?  I personally don't believe so, that doesn't 
make sense because [] should be an element of the array.  If that is the case, 
then the code in crackArgv is still broken, even with the above fix.

I am currently looking at fixing crackArgv using the length() method rather
than looking for '\0', but I wanted to make sure that I was corect that the
fxAssert line needed to be changed.. 

It's such a foundation of everything, I'm scared of changing it & having 
everything break!!

Thoughts??


The proof.......................

FaxQueuer[20588]: readConfigItem with NotifyCmd	"/usr/local/tpc/tpcnotify.pl"
FaxQueuer[20588]: Got notifycmd and /usr/local/tpc/tpcnotify.pl
FaxQueuer[20588]: faxQueueApp::setConfigItem with notifycmd, /usr/local/tpc/tpcnotify.pl
FaxQueuer[20588]: In findTag with notifycmd
FaxQueuer[20588]: Leaving findTag - true
FaxQueuer[20588]: Trying to set the value to a string
FaxQueuer[20588]: In operator=(const char *s)
FaxQueuer[20588]: in resizeInternal, requested chars is 27
FaxQueuer[20588]: resizeInternal, slength=11, data=bin/notify
FaxQueuer[20588]: Called realloc with 28
FaxQueuer[20588]: Leaving resizeInternal
FaxQueuer[20588]: Finished setting the value of the string
FaxQueuer[20588]: in crackArgv
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 0<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 0<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 1<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 1<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 2<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 2<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 3<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 3<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 4<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 4<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 5<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 5<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 6<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 6<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 7<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 7<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 8<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 8<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 9<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 9<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 10<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 10<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 11<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 11<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 12<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 12<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 13<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 13<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 14<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 14<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 15<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 15<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 16<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 16<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 17<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 17<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 18<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 18<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 19<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 19<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 20<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 20<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 21<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 21<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 22<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 22<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 23<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 23<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 24<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 24<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 25<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 25<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 26<28-1
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 26<28-1
FaxQueuer[20588]: crackArgv: Looking for end
FaxQueuer[20588]: (int)Data: /usr/local/tpc/tpcnotify.pl, 27<28-1
FaxQueuer[20588]: Assertion failed "Invalid Str[] index", file "../util/Str.h" line 126. 


Thanks,
-- 
	Steve Williams, Calgary, Alberta, Canada
	Genie Computer Systems Inc.
	steve@genie96.com

"A man doesn't begin to attain wisdom until he recognizes that he is 
 no longer indispensable."
- Admiral Richard E. Byrd ( 1888-1957 )



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services