- client: check return value of FILE_REF when parse project file.

Fixes crashing bug.


svn path=/trunk/boinc/; revision=24579
This commit is contained in:
David Anderson 2011-11-11 17:18:04 +00:00
parent 14cf8873b0
commit 0e823f6734
3 changed files with 32 additions and 16 deletions

View File

@ -8384,3 +8384,12 @@ Charlie 11 Nov 2011
clientgui/
sg_TaskPanel.cpp
David 11 Nov 2011
- client: check return value of FILE_REF when parse project file.
Fixes crashing bug.
client/
client_types.cpp
ssim/
ssim.cpp

View File

@ -667,6 +667,7 @@ void FILE_XFER_BACKOFF::file_xfer_succeeded() {
int PROJECT::parse_project_files(XML_PARSER& xp, bool delete_existing_symlinks) {
unsigned int i;
char project_dir[256], path[256];
int retval;
if (delete_existing_symlinks) {
// delete current sym links.
@ -687,8 +688,10 @@ int PROJECT::parse_project_files(XML_PARSER& xp, bool delete_existing_symlinks)
if (xp.match_tag("/project_files")) return 0;
if (xp.match_tag("file_ref")) {
FILE_REF file_ref;
file_ref.parse(xp);
project_files.push_back(file_ref);
retval = file_ref.parse(xp);
if (!retval) {
project_files.push_back(file_ref);
}
} else {
if (log_flags.unparsed_xml) {
msg_printf(0, MSG_INFO,
@ -1486,7 +1489,7 @@ int FILE_REF::parse(XML_PARSER& xp) {
if (xp.parse_bool("no_validate", temp)) continue;
if (log_flags.unparsed_xml) {
msg_printf(0, MSG_INFO,
"[unparsed_xml] FILE_REF::parse(): unrecognized: %s\n",
"[unparsed_xml] FILE_REF::parse(): unrecognized: '%s'\n",
xp.parsed_tag
);
}

View File

@ -11,9 +11,9 @@ using std::set;
// this many packets per meta-packet
#define N 10
// need this many to reconstruct the meta-packet
#define METAK 15
#define META_K 15
// similar, meta-packets per file
#define METAN 10
#define META_N 10
#define HOSTS_PER_DAY 10.
#define HOST_LIFE_MEAN 100.*86400
@ -38,6 +38,8 @@ struct HOST : public EVENT {
double upload_bytes_sec;
double download_bytes_sec;
virtual void handle() {
// the host has departed
//
set<HOST*>::iterator i = hosts.find(this);
hosts.erase(i);
}
@ -62,15 +64,16 @@ struct REPORT_STATS : public EVENT {
}
};
struct PACKET_HOST : public EVENT {
enum {DOWNLOADING, PRESENT, UPLOADING} state;
virtual void handle() {
}
};
// a packet is associated with at most one host
//
struct PACKET {
set<PACKET_HOST*> packet_hosts;
enum {DOWNLOADING, PRESENT, UPLOADING} state;
HOST* host;
bool present; // present on server
virtual void handle() {
// transfer has finished
//
}
};
struct META_PACKET {
@ -84,12 +87,13 @@ struct DFILE : EVENT {
// hosts that don't have any packets of this file
int nmeta_packets_present;
virtual void handle() {
for (int i=0; i<META_N; i++) {
for (int i=0; i<META_K; i++) {
META_PACKET* mp = new META_PACKET;
mp->present = true;
meta_packts.push_back(mp);
for (int j=0; j<N; j++) {
mp->npackets_present = K;
meta_packets.push_back(mp);
for (int j=0; j<K; j++) {
PACKET* p = new PACKET;
p->present = true;
mp->packets.push_back(p);
}
}