haberman / vtparse Goto Github PK
View Code? Open in Web Editor NEWA library to parse terminal escape sequences exactly how the real hardware does.
Home Page: http://vt100.net/emu/dec_ansi_parser
A library to parse terminal escape sequences exactly how the real hardware does.
Home Page: http://vt100.net/emu/dec_ansi_parser
Feeding the following character sequence into ./test
causes an out-of-bounds write in line 60 of vtparse.c
:
echo -en "\e["`printf '99;%.0s' {0..15}`m | ./test
Relevant code snippet:
/* process the param character */
if(ch == ';')
{
parser->num_params += 1;
parser->params[parser->num_params-1] = 0; /* <- bad */
}
Fortunately, at the moment, this is not a severe issue, since the next member after params
in struct vtparser
is num_params
, which is reset to zero in the above code. However, if params
was at the end of the vtparser
structure, this would allow to override whatever comes next in memory. Still, even with the way it is right now, writing outside the bounds of a fixed-size array is undefined behaviour and should be fixed.
I suggest an explicit check before incrementing num_params
and going to an error state if parser->num_params
is greater than the size of the params
array.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.