https://sourceware.org/bugzilla/show_bug.cgi?id=30598
Bug ID: 30598 Summary: strings crashes when told to search for strings of size 0x40000000 and give special treatment to UTF-8 characters Product: binutils Version: 2.41 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: gabravier at gmail dot com Target Milestone: --- Version of the utility: $ ./binutils/strings --version GNU strings (GNU Binutils) 2.40.50.20230630 Copyright (C) 2023 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty. Patches: None, the source code used is current HEAD (git commit 0d1cd7d97835941c046dbb7ec1c83bc7c05779e6) Type of machine used, OS and version number: $ uname -a Linux fedora 6.3.8-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 15 02:15:40 UTC 2023 x86_64 GNU/Linux Compiler used to compile the utilities: $ gcc --version gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4) Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Command arguments used to reproduce the bug: $ ./binutils/strings -U locale -n0x40000000 <(head -c50000000 /dev/zero | tr '\0' a) Segmentation fault (core dumped) Behavior I observe that I believe is incorrect: strings crashes. I believe it should output nothing as there are no strings longer than 1073741824 characters in the provided input file. See also https://sourceware.org/bugzilla/show_bug.cgi?id=30595, which this derives from: the fix there fixed the initial issue, but the check that tries to make sure `print_unicode_stream` won't allocate a too-large buffer is faulty. -- You are receiving this mail because: You are on the CC list for the bug.