|
From: Jim C. <gre...@yg...> - 2002-09-06 03:51:31
|
Gilles Detillieux's bits of Thu, 5 Sep 2002 translated to: >According to Jim Cole: >> I think there is a bug in htnotify's readPreAndPostamble(). Both >> htnotify_prefix_file and htnotify_suffix_file have a default >> value of "", but the code only checks for NULL when examining the >> values of prefixfile and suffixfile. The code then proceeds to >> create ifstream objects using the default values. Finally, the >> streams are checked with 'if (! in.bad())'; however the ifstream >> constructor sets failbit, rather than badbit, when it is unable >> to open the specified file. The result is that the code drops >> into a while loop and starts extracting from an undefined stream >> object. ... >Yes, this was reported just a few weeks ago, and a patch was provided. >See ftp://ftp.ccsf.org/htdig-patches/3.1.6/ Sorry. I somehow missed that post. However, even with the patch I believe the code in both 3.1.6 and 3.2.x is incorrect. If the name of a non-existent file was provided, the same problem with infinite looping could occur. As I understand the standard, the check of in.bad() is of no use with regard to whether the file was opened successfully. If on the other hand in.good() is checked, then it would ensure that neither badbit nor failbit is set. Jim |