[Boost-bugs] [Boost C++ Libraries] #12799: Crash occurs inside fiber inside sscanf on Android

Subject: [Boost-bugs] [Boost C++ Libraries] #12799: Crash occurs inside fiber inside sscanf on Android
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-01-31 19:15:23


#12799: Crash occurs inside fiber inside sscanf on Android
-----------------------------------+---------------------
 Reporter: Lev Sch <zorechfan@…> | Owner: olli
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: context
  Version: Boost 1.63.0 | Severity: Problem
 Keywords: |
-----------------------------------+---------------------
 I started migrating from boost_1_62_0 to boost_1_63_0.

 Migration failed: application crashed (no changes in my code).

 I have constructed a minimal example that leads to crash. The test
 (boostTest.cpp file):

 {{{
 #include <cassert>
 #include <android/log.h>
 #include <boost/context/all.hpp>

 #define TRACE(...) __android_log_print(ANDROID_LOG_DEBUG, "boostTest",
 __VA_ARGS__)

 void callSscanf()
 {
   TRACE("callSscanf begin");
   TRACE("callSscanf line=%d",__LINE__);
   if ( true ) {
     int n1=0;
     int n2=0;
     sscanf("1 23", "%d %d", &n1,&n2);
     assert(n1==1);
     assert(n2==23);
   }
   TRACE("callSscanf line=%d",__LINE__);
   if(true) {
     int n1=0;
     int n2=0;
     sscanf("1 jjj 23", "%d %*[j] %d", &n1,&n2);
     assert(n1==1);
     assert(n2==23);
   }
   TRACE("callSscanf end");
 }

 void FiberProc(void* arg)
 {
   TRACE("FiberProc begin");
   boost::context::execution_context& mainCtx =
 *((boost::context::execution_context*)arg);
   callSscanf();
   mainCtx();
   TRACE("FiberProc unreachable!!!");
   assert(false); // not reachable
 }

 void boostContextTest()
 {
   TRACE("boostContextTest start");
   {
     TRACE("boostContextTest calling WITHOUT fiber");
     callSscanf();
   }
   {
     TRACE("boostContextTest calling WITH fiber");
     boost::context::execution_context
 mainCtx(boost::context::execution_context::current());
     boost::context::execution_context childCtx(&FiberProc);
     childCtx(&mainCtx);
   }

   TRACE("boostContextTest end");
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12799>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:21 UTC