delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/08/11/21:30:53

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,TW_CP
X-Spam-Check-By: sourceware.org
Resent-Message-Id: <201108120130 DOT p7C1UN3b012281 AT matsrv DOT math DOT cas DOT cz>
Message-Id: <201108120130.p7C1UN3b012281@matsrv.math.cas.cz>
Date: Fri, 12 Aug 2011 03:10:13 +0200
From: Jan Kolar <kolar AT math DOT cas DOT cz>
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: buffer size calculation in gethostby_helper()
Resent-From: kolar AT math DOT cas DOT cz
Resent-Date: Fri, 12 Aug 2011 03:30:23 +0200
Resent-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Dear Corinna,
Please note that in net.cc, some kind of
               string_size += addrsize_out;
is missing somewhere, which affects a buffer allocation.
See the two locations in diff.
(I do not see well how the two loops (passes) communicate, which might 
well be the origin of the problem.)


The problem was discovered with mplayer with some URLs, with DEBUGGING 
defined.

Best regards
Jan

--------------------------
EXAMPLE
$  mplayer.exe 
'http://www.ceskatelevize.cz/ivysilani/1096898594-udalosti-komentare/211411000370805/'
MPlayer SVN-r32518-snapshot-4.5.1 (C) 2000-2010 MPlayer Team
159 audio & 349 video codecs

Playing 
http://www.ceskatelevize.cz/ivysilani/1096898594-udalosti-komentare/211411000370805/.
Resolving www.ceskatelevize.cz for AF_INET6...

Couldn't resolve name for AF_INET6: www.ceskatelevize.cz
Resolving www.ceskatelevize.cz for AF_INET...
  223037 [main] mplayer 7812 gethostby_helper: Note: JK hopping to fix 
the -4 bug in net.cc saying (if defed DEBUGGING) 'Please debug.'
Connecting to server www.ceskatelevize.cz[212.47.26.209]: 80...

Cache size set to 320 KBytes
Cache fill:  0.00% (0 bytes)
Exiting... (End of file)

------------------------

DIFF
$ cd /usr/src/cygwin-1.7.6-1/winsup/ && diff -up 
../rozbalene-orig-src.tar.bz2/cygwin-1.7.6-1/winsup/cygwin/net.cc 
cygwin/net.cc
--- ../rozbalene-orig-src.tar.bz2/cygwin-1.7.6-1/winsup/cygwin/net.cc    
2010-08-16 15:55:07.000000000 +0200
+++ cygwin/net.cc    2011-08-12 00:07:51.709992400 +0200
@@ -1109,6 +1109,8 @@ gethostby_helper (const char *name, cons
        else if (address_len != namelen1)
          continue;
        address_count++;
+          string_size += addrsize_out; // jk-2011 hope this fixes the 
BUG below
+          system_printf ("Note: JK hopping to fix the -4 bug in net.cc 
saying (if defed DEBUGGING) 'Please debug.' ");
      }
        /* Update the records */
        curptr->type = antype; /* Host byte order */
@@ -1192,7 +1194,7 @@ gethostby_helper (const char *name, cons
            else
          memcpy (string_ptr, curptr->data, addrsize_in);
            string_ptr += addrsize_out;
-          string_size -= addrsize_out;
+          string_size -= addrsize_out; // jk-2011 FIXME BUG:   this 
makes it -4 sometimes - before my fix.
            continue;
          }
  #ifdef DEBUGGING


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019