mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +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,
|
OutputStream* out,
|
||||||
const char* startName,
|
const char* startName,
|
||||||
const char* endName,
|
const char* endName,
|
||||||
const char* format,
|
Platform* platform,
|
||||||
const char* architecture,
|
|
||||||
unsigned alignment,
|
unsigned alignment,
|
||||||
bool writable,
|
bool writable,
|
||||||
bool executable)
|
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)};
|
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;
|
uint8_t* data = 0;
|
||||||
unsigned size;
|
unsigned size;
|
||||||
int fd = open(argv[1], O_RDONLY);
|
int fd = open(argv[1], O_RDONLY);
|
||||||
@ -148,8 +152,7 @@ int main(int argc, const char** argv)
|
|||||||
&out,
|
&out,
|
||||||
argv[3],
|
argv[3],
|
||||||
argv[4],
|
argv[4],
|
||||||
argv[5],
|
platform,
|
||||||
argv[6],
|
|
||||||
alignment,
|
alignment,
|
||||||
writable,
|
writable,
|
||||||
executable);
|
executable);
|
||||||
|
Loading…
Reference in New Issue
Block a user