mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-28 12:36:35 +00:00
Avoid blowing the call stack when parsing larg cursor files
This commit is contained in:
parent
9442e86494
commit
89ca18f9c4
4 changed files with 20 additions and 5 deletions
|
|
@ -1,5 +1,11 @@
|
|||
# Changelog for `ani-cursor`
|
||||
|
||||
## Next (unreleased)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Prevent "Maximum call stack size exceeded" error when parsing large cursors.
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Bug Fixes
|
||||
|
|
|
|||
|
|
@ -79,8 +79,12 @@ function readAni(contents: Uint8Array): AniCursorImage {
|
|||
let i = 0;
|
||||
const uniqueId = () => i++;
|
||||
|
||||
function base64FromDataArray(dataArray: Uint8Array): string {
|
||||
return window.btoa(String.fromCharCode(...dataArray));
|
||||
export function base64FromDataArray(dataArray: Uint8Array): string {
|
||||
return window.btoa(
|
||||
Array.from(dataArray)
|
||||
.map((byte) => String.fromCharCode(byte))
|
||||
.join("")
|
||||
);
|
||||
}
|
||||
|
||||
function curUrlFromByteArray(arr: Uint8Array) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
- Fix a number of edge cases where the close and minimize buttons in the equalizer window could render the wrong sprite [#1046](https://github.com/captbaritone/webamp/pull/1046)
|
||||
- Fix a bug where unminified bundle was accidentally minified.
|
||||
- Treat skin files with forward slashes in their filename as directories [#1052](https://github.com/captbaritone/webamp/pull/1052)
|
||||
- Prevent "Maximum call stack size exceeded" error when parsing large cursors.
|
||||
|
||||
## 1.4.2
|
||||
|
||||
|
|
|
|||
|
|
@ -132,9 +132,13 @@ export const clamp = (value: number, min: number, max: number): number =>
|
|||
export const sum = (values: number[]): number =>
|
||||
values.reduce((total, value) => total + value, 0);
|
||||
|
||||
export const base64FromDataArray = (dataArray: Uint8Array): string => {
|
||||
return window.btoa(String.fromCharCode(...dataArray));
|
||||
};
|
||||
export function base64FromDataArray(dataArray: Uint8Array): string {
|
||||
return window.btoa(
|
||||
Array.from(dataArray)
|
||||
.map((byte) => String.fromCharCode(byte))
|
||||
.join("")
|
||||
);
|
||||
}
|
||||
|
||||
export const base64FromArrayBuffer = (arrayBuffer: ArrayBuffer): string => {
|
||||
return base64FromDataArray(new Uint8Array(arrayBuffer));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue