From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16394 invoked by alias); 21 Nov 2015 05:33:29 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 16382 invoked by uid 89); 21 Nov 2015 05:33:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=4.1 required=5.0 tests=BAYES_60,CHARSET_FARAWAY_HEADER,RP_MATCHES_RCVD,SPF_PASS autolearn=no version=3.3.2 X-HELO: smtpout.ngs.ru Received: from smtpout32.ngs.ru (HELO smtpout.ngs.ru) (195.19.71.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 21 Nov 2015 05:33:26 +0000 Received: from mx14.intranet.ru (mx14.intranet.ru [172.16.7.2]) by mail.ngs.ru (smtp) with ESMTP id 812E11823D6 for ; Sat, 21 Nov 2015 11:33:20 +0600 (NOVT) Received: from mx27.intranet.ru (mx27.intranet.ru [172.16.7.15]) by mx14.intranet.ru (mx14.intranet.ru) with ESMTP id 7E982FB64 for ; Sat, 21 Nov 2015 11:33:20 +0600 (NOVT) Received: from [37.192.58.78] (account rod1gin@ngs.ru) by mx27.intranet.ru (CommuniGate Pro WebUser 4.3.11) with HTTP id 32611685 for cygwin@cygwin.com; Sat, 21 Nov 2015 11:33:20 +0600 From: "=?KOI8-R?Q?=F2=CF=CD=C1=CE?=" Subject: Errors in handling of boost::asio errors ('boost' was compiled with wrong std::string representation?) To: cygwin@cygwin.com Date: Sat, 21 Nov 2015 05:33:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="KOI8-R"; format="flowed" Content-Transfer-Encoding: 8bit X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 75324 [Mar 30 2015] X-KLMS-AntiSpam-Version: 5.5.4 X-KLMS-AntiSpam-Envelope-From: rod1gin@ngs.ru X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Info: LuaCore: 175 2015-03-18_14-10-30 59b0fb5d1fe0bc13ab72a23d6aa445f4185e0a58, Auth:dkim=none X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiPhishing: Clean, 2015/03/25 07:44:58 X-KLMS-AntiVirus: Kaspersky Security 8.0 for Linux Mail Server, version 8.0.1.705, bases: 2015/03/29 19:07:00 #10436451 X-KLMS-AntiVirus-Status: Clean, skipped X-SW-Source: 2015-11/txt/msg00303.txt.bz2 Following program: --------------- begin of code #include #include int main() { std::string s = boost::system::generic_category().message(22); printf("size=%lu, c_str=\"%s\".\n", s.size(), s.c_str()); return 0; } --------------- end of code Give out following output: --------------- begin of output size=1628781863, c_str="Invalid argument". --------------- end of output If I try to use such string, for example: std::string a(""); a += s; program crashes. The program was compiled from cygwin command line by following commands: --------------- begin of commands g++ -c test.cpp gcc -s test.o -lstdc++ -lboost_system --------------- end of commands I used fresh installed cygwin with following additional packages: Devel / gcc-core 5.2.0-1 Devel / gcc-g++ 5.2.0-1 Libs / libgcc1 5.2.0-1 Libs / libstdc++6 5.2.0-1 Devel / make 4.1-1 Libs / libboost-devel 1.58.0-1 Operating system: Windows XP, 32 bits, russian language Processor: Intel Pentium 4 (3 GHz) Version of installator: setup-x86.exe, 2.873 With libboost-devel 1.57.0-1 effect is the same. With Windows 7, 64 bit, russian language, effect is the same (with 32-bit and with 64-bit cygwin), with the exception that another wrong values are exposed for 'size'. When I compile boost from sources ('boost_1_59_0.7z' from boost org), the same program is running as proper: --------------- begin of correct output size=16, c_str="Invalid argument". --------------- end of correct output Constant '22' corresponds to 'boost::asio::error::invalid_argument'. Some other ASIO error codes also brings to the same effect. Aforementioned code is used in handling of exceptions from ASIO functions and brings to crashes in various unpredictable situations. There is more real-life piece of code that produce same error: --------------- begin of example #2 #include #include int main() { boost::asio::ip::address_v4 a; boost::system::error_code ec; a.from_string("127.0.0.1111", ec); std::string s = ec.message(); printf("size=%lu, c_str=\"%s\".\n", s.size(), s.c_str()); return 0; } --------------- end of example #2 -- 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