mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Print a warning if deserialized rstime_t is negative
This commit is contained in:
parent
a89c29030a
commit
a47eec14e4
@ -26,8 +26,10 @@
|
|||||||
#include "retroshare/rstypes.h"
|
#include "retroshare/rstypes.h"
|
||||||
#include "serialiser/rsbaseserial.h"
|
#include "serialiser/rsbaseserial.h"
|
||||||
#include "util/rsnet.h"
|
#include "util/rsnet.h"
|
||||||
|
#include "util/rstime.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
/* UInt8 get/set */
|
/* UInt8 get/set */
|
||||||
|
|
||||||
@ -293,6 +295,10 @@ bool getRawTimeT(const void *data,uint32_t size,uint32_t *offset,rstime_t& t)
|
|||||||
bool res = getRawUInt64(data,size,offset,&T);
|
bool res = getRawUInt64(data,size,offset,&T);
|
||||||
t = T;
|
t = T;
|
||||||
|
|
||||||
|
if(t < 0) // [[unlikely]]
|
||||||
|
std::cerr << __PRETTY_FUNCTION__ << " got a negative time: " << t
|
||||||
|
<< " this seems fishy, report to the developers!" << std::endl;
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
bool setRawTimeT(void *data, uint32_t size, uint32_t *offset, const rstime_t& t)
|
bool setRawTimeT(void *data, uint32_t size, uint32_t *offset, const rstime_t& t)
|
||||||
|
Loading…
Reference in New Issue
Block a user