annotate runtime/syntax/srt.vim @ 33865:8cdb69ea3711 v9.0.2143

patch 9.0.2143: [security]: buffer-overflow in ex_substitute Commit: https://github.com/vim/vim/commit/abfa13ebe92d81aaf66669c428d767847b577453 Author: Christian Brabandt <cb@256bit.org> Date: Thu Nov 30 11:32:18 2023 +0100 patch 9.0.2143: [security]: buffer-overflow in ex_substitute Problem: [security]: buffer-overflow in ex_substitute Solution: clear memory after allocating When allocating the new_start pointer in ex_substitute() the memory pointer points to some garbage that the following for loop in ex_cmds.c:4743 confuses and causes it to accessing the new_start pointer beyond it's size, leading to a buffer-overlow. So fix this by using alloc_clear() instead of alloc(), which will clear the memory by NUL and therefore cause the loop to terminate correctly. Reported by @henices, thanks! closes: #13596 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Dec 2023 15:16:05 +0100
parents 0827d3d6d8c0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30324
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: SubRip
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: ObserverOfTime <chronobserver@disroot.org>
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Filenames: *.srt
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Last Change: 2022 Sep 12
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 if exists('b:current_syntax')
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 finish
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 endif
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 syn spell toplevel
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 syn cluster srtSpecial contains=srtBold,srtItalics,srtStrikethrough,srtUnderline,srtFont,srtTag,srtEscape
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 " Number
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 syn match srtNumber /^\d\+$/ contains=@NoSpell
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 " Range
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 syn match srtRange /\d\d:\d\d:\d\d[,.]\d\d\d --> \d\d:\d\d:\d\d[,.]\d\d\d/ skipwhite contains=srtArrow,srtTime nextgroup=srtCoordinates
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 syn match srtArrow /-->/ contained contains=@NoSpell
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 syn match srtTime /\d\d:\d\d:\d\d[,.]\d\d\d/ contained contains=@NoSpell
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 syn match srtCoordinates /X1:\d\+ X2:\d\+ Y1:\d\+ Y2:\d\+/ contained contains=@NoSpell
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 " Bold
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 syn region srtBold matchgroup=srtFormat start=+<b>+ end=+</b>+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 syn region srtBold matchgroup=srtFormat start=+{b}+ end=+{/b}+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 " Italics
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 syn region srtItalics matchgroup=srtFormat start=+<i>+ end=+</i>+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 syn region srtItalics matchgroup=srtFormat start=+{i}+ end=+{/i}+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 " Strikethrough
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 syn region srtStrikethrough matchgroup=srtFormat start=+<s>+ end=+</s>+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 syn region srtStrikethrough matchgroup=srtFormat start=+{s}+ end=+{/s}+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 " Underline
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 syn region srtUnderline matchgroup=srtFormat start=+<u>+ end=+</u>+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 syn region srtUnderline matchgroup=srtFormat start=+{u}+ end=+{/u}+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 " Font
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 syn region srtFont matchgroup=srtFormat start=+<font[^>]\{-}>+ end=+</font>+ contains=@srtSpecial
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 " ASS tags
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 syn match srtTag /{\\[^}]\{1,}}/ contains=@NoSpell
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 " Special characters
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 syn match srtEscape /\\[nNh]/ contains=@NoSpell
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 hi def link srtArrow Delimiter
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 hi def link srtCoordinates Label
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 hi def link srtEscape SpecialChar
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 hi def link srtFormat Special
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 hi def link srtNumber Number
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 hi def link srtTag PreProc
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 hi def link srtTime String
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 hi srtBold cterm=bold gui=bold
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 hi srtItalics cterm=italic gui=italic
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 hi srtStrikethrough cterm=strikethrough gui=strikethrough
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 hi srtUnderline cterm=underline gui=underline
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 let b:current_syntax = 'srt'