Corrections of unhandled exceptions/illegal file contents and sizes related to some ''.scl'' and ''.kbm'' files (@020f0c07) #4
FulopNandor
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When certain ''.scl'' and/or ''.kbm'' files are opened in Dexed, the problems listed below occur in the following cases:
-- in MS Windows 10 OS, 64-bit;
-- in 32-bit Linux (Ubuntu Bionic 18.04 and Raspbian OS bookworm).
The ''.scl'' and ''.kdm'' files referenced below originate from the repository tuning-library (@ b784235) created by the Surge Synthesizer Team, and are located in its subdirectories ''tests/data'' and ''tests/data/bad''.
WARNING! It is highly recommended to back up the ''Dexed.settings'' file, as its content may become severely corrupted in certain cases listed below, causing Dexed crash immediately upon the next launch!
COMMENT: the problems were detected primarily in MS Windows 10; for Linux, only some examples are mentioned.
Problem 1: Dexed crashes or raises unhandled exceptions when opening files
When certain ''.scl'' and/or ''.kbm'' files are opened in Dexed (either via ''File Chooser'' window invoked by buttons ''SCL'' and ''KBM'', or simply drag-n-dropped into the main window of Dexed):
These errors can be reproduced when opening the following cases:
Also, in Linux, when the binary DEVBUILD DEBUG Standalone version was launched from console, Dexed also crashed. However, some error messages originating from the exceptions were printed onto console as follows, e.g.:
Problem 2: Binary version 0.9.6 accepts illegal file
The binary version 0.9.6 accepts the ''blank-line.kbm'' file. Interestingly, its content can be seen in edit window invoked by ''KBM'' button in the dialog ''Current Tuning'':
However, if we exit 0.9.6 after loading the ''blank-line.kbm'' file, then 0.9.6 cannot be lauched. This is because such corrupted content was saved in setting file ''Dexed.settings'' upon exit, which prevents Dexed from starting up.
It is worth noting that DEVBUILD DEBUG version does not accept this illegal file, but it crashes instead:
Problem 3: Exception ''vector subscript out of range''
When file ''6-exact.scl'' is opened first, followed by the file ''eightnote-c-100.kbm'', the 0.9.6. appears to accept and handle it. However, if the DEBVUILD DEBUG Standalone version is launched, an error message appears on the screen:
Alternatively, the following output is displayed in the debugger:
Problem 4: Opening large-sized file with illegal content
If a large-sized file is opened, which incidentally has the ''.scl'' or ''.kbm'' extension and contains other data than a legel scale or keyboard mapping file should contain, (e.g. an entire webpage containing an interest scale/keyboard map is accidentally saved with the ''.scl'' or ''.kbm'' extension), Dexed crashes.
Problem 5: File extensions can be overwritten
When a user wants to open an ''.scl'' file by clicking the ''SCL'' button, the file extension can be overwritten in the ''File Open'' dialog provided by the OS, allowing any other files appearing in the dialog to be loaded.
However, the opened file is processed according to code intended to interpret the ''.scl'' files. Because the syntax rules of ''.scl'' and ''.kbm'' files are quite permissive, the content of some ''.kbm'' files could formally be interpreted as ''.scl'' file, and vice versa. For example, if file ''threenote-c-100-from-1.kbm'' is loaded as an ''.scl'' file due to the modification of the extension in the ''File Open'' dialog, an erroneous state occurs from two perspectives: on one hand, inappropriate data are loaded specifying a propably useless scale, and on the other hand, it demonstates that such large values can appear in ''Current Tuning'' window, which cannot be displayed properly.
Even the exported ''.csv'' file contain too long numbers (the longest one has 155 digit).
Problem 6: Truncated content in file content window of ''Current Tuning'' dialog
In the file content vindow, which can be invoked by ''SCL'' button in ''Current Tuning'' dialog, there is no scrolling option; if the file is longer (e.g in the case of ''31edo_dos_lineends.scl''), only the central 26 lines can be seen:
Problem 7: Non-functional GUI controls in the header of ''Current Tuning'' dialog
In the ''Current Tuning'' dialog, sorting icons appear when a user clicks onto any label in the header, and a popup menu is invoked by a right click on the header in the table. However, there is no code implemented to perform either the sorting the cells or the manipulation of the column width.
Problem 8: Zero ''ColumnId''
In debug mode, a JUCE ''jassert()'' is triggered when the ''Current Tuning'' dialog is opened by clicking on ''Show'' button. The reason for this is that a 0 value is used as ''ColumnId'' for the column that displays the notes, which value should be avoided according to the JUCE API.
Summary of this commit
This commit provides the following modifications to overcome problems above:
it updates the reference of the ''surgesyntteam/tuning-library'' repository to the latest one to avoid the ''vector subscript out of range'' exception, replacing the current ''tuning-library'' referenced in current repository of Dexed;
it intercepts and handles the exceptions occurred in ''tuning-library'' due to the illegal content of ''.scl'' and ''.kbm'' files, which were previously neglected. A JUCE AlertWindow is shown to inform the user about the reason for the error. The error messages are the returned values of the ''what()'' method of the exceptions thrown by the ''tuning-library'';
it introduces a maximum file length (16KB) for ''.scl'' and ''.kbm'' files; it refuses files with zero length or those larger than the maximum, and shows error messages in a JUCE AlertWindow (The Huygens-Fokker's Scala Archive contains 6159 ''.scl'' files. Of these, 5121 files are less than 1KB, only 55 files exceed the 1 KB size, and the largest one is 5388 bytes; therefore, a maximum value of 16KB seems to be a reasonable limit for practical viewpoint.);
it enforces the ''.scl'' extension when a user initates to loading of an ''.scl'' file, disallowing the loading of files with extensions other than ''.scl'' (the same rules are applied for ''.kbm'' files);
it automatically displays a vertical scroll bar in edit boxes to allow scroll through the content of longer ''.scl'' and ''.kbm'' files;
it displays numerical values in scientific form ("%12.6e") when the values exceed the limit of 1E5;
it disables the non-functional GUI controls (sorting icons, popup submenu) in the header of the table displayed in the ''Current Tuning'' dialog;
the ''Reset'' button is enabled always allowing the actual content of scale and keyboard mapping files to be viewed;
a copy of the actual (and working) tuning state is preserved in a variable named ''synthTuningStateLast''; the state is restored from this variable if there were problems during the loading of a new ''.scl'' and/or ''.kbm'' file;
the column IDs are renumbered from 1;
the calls to macro ''TRANS()'' (which was introduced for backward compatibility) are replaced by calls to ''translate()'' method;
since the above modifications affected the files in the ''surgesynthteam-tuningui'' library, I forked that to a temporary repository. It contains the modified content to replace the original library included in the current repository of Dexed. (This temporary repository is only needed until the Surge Synthesizer Team accepts these modifications and incorporates them into their original repository.)
Beta Was this translation helpful? Give feedback.
All reactions