Skip to content

Commit

Permalink
Merge pull request #1514 from silx-kit/fix-codeq-alert
Browse files Browse the repository at this point in the history
Fix overly permissive regex
  • Loading branch information
axelboc authored Oct 25, 2023
2 parents 7c132ca + 12e4ce0 commit 4917b6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/app/src/providers/h5grove/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export function convertH5GroveDtype(dtype: H5GroveDtype): DType {
}

function convertDtypeString(dtype: string): DType {
const regexp = /([<>=|])?([A-z])(\d*)/u;
const regexp = /([<>=|])?([A-Za-z])(\d*)/u;
const matches = regexp.exec(dtype);

if (matches === null) {
throw new Error(`Unknown dtype ${dtype}`);
throw new Error(`Invalid dtype string: ${dtype}`);
}

const [, endianMatch, dataType, lengthMatch] = matches;
Expand Down

0 comments on commit 4917b6b

Please sign in to comment.