You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If a large number of files that have moderately long filenames are selected in pickFiles() then app freezes or crashes.
Platform
Android
iOS
Web
Desktop
Platform OS version
Windows 11
How are you picking?
FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true, allowedExtensions: ['txt'], type: FileType.custom);
Details to reproduce the issue
Create a folder containing an emtpy text file named a.txt
Duplicate a.txt using Ctrl+A, Ctrl+C, Ctrl+V so there is 256 empty text files in the folder.
Create a new project with flutter create test
Replace the floating action button callback with one that calls pickFiles.
Run the flutter project, click the FAB, and in the file picker select all your empty text files and click open.
Observe app failure.
If all 256 txt files are named as 0.txt, 1.txt, 2.txt ... and the folder has a short path like C:\x\ then pickFiles should work as expected.
Error Log
None
Screenshots and/or video
None
Flutter Version details
PS C:\x> flutter doctor -v
[✓] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 10.0.22000.348], locale en-US)
• Flutter version 2.8.0 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cf44000065 (4 days ago), 2021-12-08 14:06:50 -0800
• Engine revision 40a99c5951
• Dart version 2.15.0
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.7)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.31911.196
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[✓] VS Code, 64-bit edition (version 1.63.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.29.0
[✓] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.348]
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.93
• Edge (web) • edge • web-javascript • Microsoft Edge 96.0.1054.43
! Doctor found issues in 2 categories.
Additional context
Replacing 20 with 4000 on this line of code solves the problem for me.
The text was updated successfully, but these errors were encountered:
Last time, I increased it to 20. Let's increase it again and wait for the next person who wants to pick even more files or longer file paths. I'm really wondering what value to set it to.
fixes#918; the buffer lpstrFile stores the paths and file names of the
selected files. As it turns out, 20 * 260 Bytes isn't enough when a
user wants to select > 256 files. Changed the buffer size to
8192 * 260 Bytes (~2.1 MB) which, depending on the file path, is enough
for picking > 2000 files. 8192 * 260 Bytes should fit at minimum
532,480 UTF16 characters. The memory profiler of Flutter DevTools shows
no memory increase while the file picker dialog is open.
Windows Task Manager shows a memory increase of 1 - 2 MB while the file
picker dialog is opened.
Describe the bug
If a large number of files that have moderately long filenames are selected in pickFiles() then app freezes or crashes.
Platform
Platform OS version
Windows 11
How are you picking?
Details to reproduce the issue
Create a folder containing an emtpy text file named
a.txt
Duplicate
a.txt
using Ctrl+A, Ctrl+C, Ctrl+V so there is 256 empty text files in the folder.Create a new project with
flutter create test
Replace the floating action button callback with one that calls pickFiles.
Run the flutter project, click the FAB, and in the file picker select all your empty text files and click open.
Observe app failure.
If all 256 txt files are named as
0.txt, 1.txt, 2.txt ...
and the folder has a short path likeC:\x\
then pickFiles should work as expected.Error Log
None
Screenshots and/or video
None
Flutter Version details
Additional context
Replacing 20 with 4000 on this line of code solves the problem for me.
The text was updated successfully, but these errors were encountered: