GithubHelp home page GithubHelp logo

fredrikaleksander / hexeterminal Goto Github PK

View Code? Open in Web Editor NEW
38.0 3.0 3.0 10.09 MB

Library for embedding Terminal Emulators

License: Other

CMake 1.24% C++ 82.97% C 8.81% Objective-C 5.02% Python 1.97%

hexeterminal's Issues

Out-of-bounds access/segfault during terminal selection

Hey, very nice job with the terminal!
I was testing terminal selection together with dear imgui implementation, and was able to "segfault" the application getting the cursor to the edges.
I think here are some out of bounds access possibilities.

diff --git a/hexeterminal/src/TerminalEmulator.cpp b/hexeterminal/src/TerminalEmulator.cpp
index b63e353..dba54cf 100644
--- a/src/TerminalEmulator.cpp
+++ b/src/TerminalEmulator.cpp
@@ -400,6 +400,10 @@ void TerminalEmulator::selnormalize(void)
     selsnap(&sel.nb.x, &sel.nb.y, -1);
     selsnap(&sel.ne.x, &sel.ne.y, +1);

+    /* selection is over terminal size? */
+    sel.nb.y = MIN( term.bot, sel.nb.y );
+    sel.ne.y = MIN( term.bot, sel.ne.y );
+
     /* expand selection over line breaks */
     if (sel.type == SEL_RECTANGULAR)
         return;
@@ -515,7 +519,7 @@ TerminalEmulator::getsel(void)
     ptr = str = (char *)xmalloc(bufsize);

     /* append every set & selected glyph to the selection */
-    for (y = sel.nb.y; y <= sel.ne.y; y++)
+    for (y = sel.nb.y; y <= sel.ne.y && y < term.row; y++)
     {
         if ((linelen = tlinelen(y)) == 0)

Improve the readme

The readme needs some work to better demonstrate the capabilities and usage of the library

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.