eric6/ThirdParty/EditorConfig/editorconfig/ini.py

changeset 7981
89e8d8d8a9b5
parent 6996
7d5a103bdb76
--- a/eric6/ThirdParty/EditorConfig/editorconfig/ini.py	Thu Jan 14 17:58:40 2021 +0100
+++ b/eric6/ThirdParty/EditorConfig/editorconfig/ini.py	Thu Jan 14 18:01:59 2021 +0100
@@ -27,6 +27,10 @@
 
 __all__ = ["ParsingError", "EditorConfigParser"]
 
+MAX_SECTION_LENGTH = 4096
+MAX_PROPERTY_LENGTH= 50
+MAX_VALUE_LENGTH = 255
+
 
 class EditorConfigParser(object):
 
@@ -134,6 +138,8 @@
                 mo = self.SECTCRE.match(line)
                 if mo:
                     sectname = mo.group('header')
+                    if len(sectname) > MAX_SECTION_LENGTH:
+                        continue
                     in_section = True
                     matching_section = self.matches_filename(fpname, sectname)
                     # So sections can't start with a continuation line
@@ -154,6 +160,9 @@
                         if optval == '""':
                             optval = ''
                         optname = self.optionxform(optname.rstrip())
+                        if (len(optname) > MAX_PROPERTY_LENGTH or
+                            len(optval) > MAX_VALUE_LENGTH):
+                            continue
                         if not in_section and optname == 'root':
                             self.root_file = (optval.lower() == 'true')
                         if matching_section:

eric ide

mercurial