summaryrefslogtreecommitdiff
path: root/src/fe-common/core/formats.c
AgeCommit message (Collapse)Author
2017-11-20Update formats.cailin-nemui
remove now useless check for ,
2017-11-15reset colour at comma, like mIRCailin-nemui
Fixes #742 and #740
2017-05-18Add parse_uint function to improve integer overflow handlingdequis
Originally found by oss-fuzz (issue 525) in get_ansi_color using ubsan. After a lot of analysis I'm 99% sure this isn't security relevant so it's fine to handle this publicly. The fix is mainly adding a function that does it right and use it everywhere. This is harder than it seems because the strtol() family of functions doesn't have the friendliest of interfaces. Aside from get_ansi_color(), there were other pieces of code that used the same (out*10+(*in-'0')) pattern, like the parse_size() and parse_time_interval() functions, which are mostly used for settings. Those are interesting cases, since they multiply the parsed number (resulting in more overflows) and they write to a signed integer parameter (which can accidentally make the uints negative without UB) Thanks to Pascal Cuoq for enlightening me about the undefined behavior of parse_size (and, in particular, the implementation-defined behavior of one of the WIP versions of this commit, where something like signed integer overflow happened, but it was legal). Also for writing tis-interpreter, which is better than ubsan to verify these things.
2017-01-02Merge branch 'percent_flag' into 'security' Nei
fix %[ See merge request !5
2016-12-20fix %[ailin-nemui
2016-12-15check for end of string in ansi 48ailin-nemui
2016-10-23Kill bell_beeps.Alexander Færøy
Fixes #524
2016-09-20Patches for heap corruption and missing bounds checkailin-nemui
By Gabriel Campana and Adrien Guinet from Quarkslab.
2016-05-13Leverage string_policy().Xavier G
2016-05-13Rename advance() into string_advance().Xavier G
2016-05-13Move advance() from fe-common/core to core.Xavier G
2015-12-28keep track of address in text_dest for hilight purposesailin-nemui
2015-09-24Applied patch from fs#275 to make /hilight -mask -line work properlyJari Matilainen
2014-10-28Fix reset of attributes with ansiAilin Nemui
reported by Christopher Ohlsson (dmnc)
2014-07-07add italics support; don't use standout for reverseLukas Mai
2014-06-30Finish 256 colour support for IrssiAilin Nemui
256 colour patch is cleaned up and the remaining cases are made work, this includes especially Theme support, which was not implemented before. Changes not related to colours were reverted again, making a review of the two patches against master easier to follow. As a byproduct of the Hex-colour code parser, the 24bit colours are also implemented. Actually using them in the terminal is guarded by a compile time switch (as well as a run time switch), as it breaks the existing colour protocol and requires additional storage. To make a seamless usage, down-conversion is provided for 8 and 16 colours. Diverging from Tom's approach, the colour protocol is reverted back to the original one. Unfortunately, the changes required in the Theme engine will break the API. For more details, please refer to the patch documentation at either http://irssi-docs.wikispaces.com/Notes-256-Colour or https://github.com/shabble/irssi-docs/wiki/Notes-256-Colour
2014-06-30Initial implementation of 256 colour support for IrssiTom Feist
This patch implements some 256 colour support for Irssi up from the previous 16 colours. Initial parsing of the %x/%X format codes is implemented and the parser accounts in advances the char* for that. The colour attributes are widened from 4 to 8 bit. The colour protocol is changed to a new format. Some pointers to remaining work are written in the comment in textbuffer.h. Note that Irssi already does support requesting 256 colours from the terminal in the original source code, so this part did not have to be touched.
2014-06-10Replace deprecated g_str[n]casecmp with g_ascii_str[n]cmp.David Hill
2009-01-13Remove broken and unused format to add an indent function to a line.Emanuele Giaquinta
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4982 dbcabf3a-b0e7-0310-adc4-f8d773084564
2009-01-10Use window_get_theme.Emanuele Giaquinta
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4980 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-11-29Fix r4920 change.Emanuele Giaquinta
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4927 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-11-24Do not strip the comma in a mirc color if it is not followed by a digit, bugEmanuele Giaquinta
#250. git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4920 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-11-15Handle bold/blink attributes like other attributes rather than mapping them toEmanuele Giaquinta
the eighth bit of the color. The formats KBGCRMYW and the mirc colors are now mapped to colors 8-15. fe-text translates colors 8-15 to bold/blink+0-7 if the terminal supports only 8 colors. git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4909 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-02-02Remove broken by design /set translation.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4698 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-02-01Reset colors and attributes on newline.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4694 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-31Assume width 1 for control characters in places where a non-negative width isEmanuele Giaquinta
expected. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4535 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-25Replace utf8_width with Markus Kuhn's wcwidth.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4518 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-20Farewell glib-1.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4509 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-08Oops. Update address correctly now.Wouter Coekaerts
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4490 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-08Update FSF addressWouter Coekaerts
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4489 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-02-14Fix format_real_length to return the correct length when the input stringEmanuele Giaquinta
includes a trailing wide char. Change statusbar_item_default_handler to compute padding also when item->size < item->min_size, needed after the fix to format_real_length. Patch by Yi-Hsuan Hsin, bug #452. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4416 dbcabf3a-b0e7-0310-adc4-f8d773084564
2006-09-20Add public is_utf8 function by refactoring existing code.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4368 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-09-15Fixed memleak in recode.c, fixed typo in special_vars.txt, fixed bug 105, ↵Valentin Batz
fixed bug 106 git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3295 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-08-20Recode patch by decadix/sennethTimo Sirainen
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3283 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-01-24reversed utf8 change, it's glib2 specific and I don't yet want to drop ↵Timo Sirainen
support for 1.x git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3216 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-01-19UTF-8 support to format_get_length() and format_real_length(). patch byTimo Sirainen
Jean-Yves Lefort git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3209 dbcabf3a-b0e7-0310-adc4-f8d773084564
2003-12-10Wrong parameters given to "gui print text" signal with indent functionTimo Sirainen
processing: remote crash for architechtures which require memory alignmentation (non-x86) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3190 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-12-28Added time, size and level setting types. Breaks some settings - I'll addTimo Sirainen
automatic converter to these settings later. Meanwhile you CVS users can fix your config files yourself :) Time settings allow using "days", "hours", "minutes", "seconds" and "milliseconds" or several of their abbreviations. For example "5d 4h 5msecs". Size settings allow using "gbytes", "mbytes", "kbytes" and "bytes" or their abbrevations. For example "5MB". Level settings are currently handled pretty much the way they were before. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3080 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-06-19strip_codes() didn't handle ANSI colors properly, and if used at the end ofTimo Sirainen
line it might have crashed irssi (especially with topics). yeah, remote crash. great. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2856 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-05-12/set hide_mirc_colors -> /set hide_colors, which also hides ANSI colors.Timo Sirainen
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2776 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-05-11removed the complaining about NULLs in string formats, they're more troubleTimo Sirainen
than worth I think. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2773 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-05-02format_read_arglist() now prints the format name also when complaining aboutTimo Sirainen
parameters. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2747 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-04-26%# now toggles monospace font on/off. fe-text doesn't care about it, butTimo Sirainen
gtk/kde UI does. By default, all lists are printed using monospace fonts. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2718 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-04-17"gui print text" signal changed, last parameter is now TEXT_DEST_REC, notTimo Sirainen
level. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2694 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-03-11default_color checks moved from fe-text to fe-common, so they work properlyTimo Sirainen
with window-specific themes. also should fix some weird problems related to them and gui_printtext_after(). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2576 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-03-10*** empty log message ***Timo Sirainen
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2553 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-03-10Foreground ANSI colors weren't workingTimo Sirainen
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2548 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-02-17Another crashfixTimo Sirainen
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2501 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-02-17"whops" :) ^D<char> as last chars in line made some screen corruption andTimo Sirainen
maybe even could have crashed git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2497 dbcabf3a-b0e7-0310-adc4-f8d773084564
2002-02-04printtext(): you can now specify server target with tag name instead ofTimo Sirainen
record. This is useful with DCC chats when you know the initial server tag but the server might be already disconnected. So what this means is that you now get ~/irclogs/ircnet/=nick.log instead of ~/irclogs/=nick.log :) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2388 dbcabf3a-b0e7-0310-adc4-f8d773084564