]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 708: prevent hangs in Phase C when the modem or the sender may get into
authorLee Howard <faxguy@howardsilvan.com>
Tue, 29 Nov 2005 21:23:56 +0000 (21:23 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Tue, 29 Nov 2005 21:23:56 +0000 (21:23 +0000)
         a funk that causes an infinite loop in the decoder.

CHANGES
faxd/tif_fax3.h

diff --git a/CHANGES b/CHANGES
index d7c7535d181d56741e163b98b999760c6260df3c..070711866fb97e5f3fa3ad9162ecae5d2d80b5b2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Changelog since HylaFAX 4.2.3
 
+* prevent some faxgetty hangs in Phase C EOL sync (29 Nov 2005)
 * fix for clients specifying TZONE LOCAL/GMT and using %Y for
   JobFmt and RcvFmt (22 Nov 2005)
 
index ad5c59f58aebc5b2d0ff1f9f5401dcc55e78ebd0..ece58eac78cc152383faf40b3eb9866dc245f4c6 100644 (file)
@@ -255,21 +255,27 @@ static const char* StateNames[] = {
  * 11 consecutive zero bits.  This means that if EOLcnt
  * is non-zero then we still need to scan for the final flag
  * bit that is part of the EOL code.
+ *
+ * In order to prevent getting forever stuck in these loops
+ * (perhaps by a hung modem or hung sender) we raiseRTC if
+ * it appears to be the case.
  */
 #define        SYNC_EOL(eoflab) do {                                           \
     if (EOLcnt == 0) {                                                 \
-       for (;;) {                                                      \
+       for (u_long i = 0;; i++) {                                      \
            NeedBits16(11,eoflab);                                      \
            if (GetBits(11) == 0)                                       \
                break;                                                  \
            ClrBits(1);                                                 \
+           if (i > 150000) raiseRTC();                                 \
        }                                                               \
     }                                                                  \
-    for (;;) {                                                         \
+    for (u_long i = 0;; i++) {                                         \
        NeedBits8(8,eoflab);                                            \
        if (GetBits(8))                                                 \
            break;                                                      \
        ClrBits(8);                                                     \
+       if (i > 150000) raiseRTC();                                     \
     }                                                                  \
     while (GetBits(1) == 0)                                            \
        ClrBits(1);                                                     \