fix(native): reject trailing text in lipo integers and keep multi-word otool keys (#531)
This commit is contained in:
@@ -58,7 +58,7 @@ export const parseLipoArchitectures = (output: string): LipoArchitecture[] => {
|
||||
};
|
||||
|
||||
const integer = (value: string | undefined): number | null => {
|
||||
if (value === undefined) return null;
|
||||
if (value === undefined || !/^\d+$/u.test(value)) return null;
|
||||
const parsed = Number.parseInt(value, 10);
|
||||
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null;
|
||||
};
|
||||
|
||||
@@ -167,7 +167,7 @@ const parseFields = (block: string): Record<string, string | number | null> => {
|
||||
const fields: Record<string, string | number | null> = {};
|
||||
for (const rawLine of block.split(/\r?\n/u).slice(1)) {
|
||||
const line = rawLine.trim();
|
||||
const match = /^(\S+(?:\s+version)?)\s+(.+)$/u.exec(line);
|
||||
const match = /^(\S+(?:\s+(?:version|stamp))?)\s+(.+)$/u.exec(line);
|
||||
if (match?.[1] === undefined || match[2] === undefined) continue;
|
||||
const value = match[2].trim();
|
||||
fields[match[1]] = numeric(value) ?? value;
|
||||
|
||||
Reference in New Issue
Block a user