From 2d36a5d4f9e75cff969b91370e240347252f9f5e Mon Sep 17 00:00:00 2001 From: jean-pierre charras <jp.charras@wanadoo.fr> Date: Thu, 10 Oct 2024 18:33:33 +0200 Subject: [PATCH] Gerbview: make buffer to read a line of Gerber file bigger. Currently, the Gerber file is parsed line by line, This is most of time OK. But warning: in rare cases some files can have *very long* lines (in fact have only one line), so the buffer must be very large. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18890 --- gerbview/gerber_file_image.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gerbview/gerber_file_image.h b/gerbview/gerber_file_image.h index 91cdb8758a..0ca270f97b 100644 --- a/gerbview/gerber_file_image.h +++ b/gerbview/gerber_file_image.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010-2019 Jean-Pierre Charras jp.charras at wanadoo.fr - * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -99,9 +99,13 @@ public: // and the actual coordinates calculation must handle this }; -// size of a single line of text from a gerber file. -// warning: some files can have *very long* lines, so the buffer must be large. -#define GERBER_BUFZ 1000000 +// Currently, the Gerber file is parsed line by line. +// This is most of time OK +// GERBER_BUFZ is the max size of a single line of text from a gerber file. +// But warning: in rare cases some files can have *very long* lines, +// so the buffer must be very large. +// I saw a file using only one line of 1,400,000 chars +#define GERBER_BUFZ 5000000 /** * Hold the image data and parameters for one gerber file and layer parameters.