Giter Site home page Giter Site logo

Comments (5)

doug-moen avatar doug-moen commented on July 23, 2024 1

Thanks for the workaround Kamila. Merry Christmas and/or Newtonmas and/or Winter Solstice!

from replxx.

doug-moen avatar doug-moen commented on July 23, 2024

i have reproduced this in my own app.

from replxx.

doug-moen avatar doug-moen commented on July 23, 2024

valgrind gives a better stack trace

==182348== Conditional jump or move depends on uninitialised value(s)
==182348==    at 0x6EC301: std::vector<char32_t, std::allocator<char32_t> >::operator=(std::vector<char32_t, std::allocator<char32_t> > const&) [clone .isra.0] (vector.tcc:224)
==182348==    by 0x6F2BAB: assign (unicodestring.hxx:74)
==182348==    by 0x6F2BAB: history_move (replxx_impl.cxx:1657)
==182348==    by 0x6F2BAB: history_move (replxx_impl.cxx:1644)
==182348==    by 0x6F2BAB: replxx::Replxx::ReplxxImpl::history_next(char32_t) (replxx_impl.cxx:1636)

the code is

    UnicodeString& assign( UnicodeString const& other_ ) {
>       _data = other_._data;
        return *this;
    }
---
history_move
>   _data.assign( _history.current() );
---
Replxx::ACTION_RESULT Replxx::ReplxxImpl::history_next( char32_t ) {
>   return ( history_move( false ) );
}

_history._current._data is an uninitialized std::vector object.

std::vector of length 266338303, capacity 2 = {<error reading variable>}

from replxx.

doug-moen avatar doug-moen commented on July 23, 2024

_history.current() is implemented like this:

    UnicodeString const& current( void ) const {
        return ( _current->text() );
    }

So _current is an iterator (a pointer) that initially does not point at a valid object (because there is no history yet).
Here we are calling _history.current() at a time when _current doesn't point to a valid object, so current() returns garbage and then we crash.

from replxx.

kspalaiologos avatar kspalaiologos commented on July 23, 2024

Workaround: add repl.history_add(""); before any invocation to input. Might break when you log repl history somewhere, but it's not the case for me.

from replxx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.