mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
make sure binary-to-object doesn't generate empty objects for invalid format/architecture combinations
This commit is contained in:
parent
5e0f7590d9
commit
46e445017e
@ -50,20 +50,11 @@ bool writeObject(uint8_t* data,
|
||||
OutputStream* out,
|
||||
const char* startName,
|
||||
const char* endName,
|
||||
const char* format,
|
||||
const char* architecture,
|
||||
Platform* platform,
|
||||
unsigned alignment,
|
||||
bool writable,
|
||||
bool executable)
|
||||
{
|
||||
Platform* platform = Platform::getPlatform(
|
||||
PlatformInfo(PlatformInfo::formatFromString(format),
|
||||
PlatformInfo::archFromString(architecture)));
|
||||
|
||||
if (!platform) {
|
||||
fprintf(stderr, "unsupported platform: %s/%s\n", format, architecture);
|
||||
return false;
|
||||
}
|
||||
|
||||
SymbolInfo symbols[] = {SymbolInfo(0, startName), SymbolInfo(size, endName)};
|
||||
|
||||
@ -113,6 +104,19 @@ int main(int argc, const char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
const char* format = argv[5];
|
||||
const char* architecture = argv[6];
|
||||
|
||||
Platform* platform = Platform::getPlatform(
|
||||
PlatformInfo(PlatformInfo::formatFromString(format),
|
||||
PlatformInfo::archFromString(architecture)));
|
||||
|
||||
if (!platform) {
|
||||
fprintf(stderr, "unsupported platform: %s/%s\n", format, architecture);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
uint8_t* data = 0;
|
||||
unsigned size;
|
||||
int fd = open(argv[1], O_RDONLY);
|
||||
@ -148,8 +152,7 @@ int main(int argc, const char** argv)
|
||||
&out,
|
||||
argv[3],
|
||||
argv[4],
|
||||
argv[5],
|
||||
argv[6],
|
||||
platform,
|
||||
alignment,
|
||||
writable,
|
||||
executable);
|
||||
|
Loading…
Reference in New Issue
Block a user