IRCaBot 2.1.0
GPLv3 © acetone, 2021-2022
#i2p-dev
/2024/11/17
@eyedeekay
&eche|on
&zzz
+R4SAS
+RN
+RN_
+T3s|4
+cumlord
+eche|off
+hagen
+orignal
+postman
+qend-irc2p
+snex
+wodencafe
Arch
Birdy
BubbRubb1
Chrono
Daddy
Danny
DeltaOreo
FreefallHeavens
Irc2PGuest39811
Irc2PGuest40504
Irc2PGuest46844
Irc2PGuest74154
Irc2PGuest88641
Irc2PGuest89876
Irc2PGuest90909
Irc2PGuest92550
Onn4l7h
Onn4|7h
Over
Sisyphus
Sleepy
SlippyJoe
Stormycloud_
T3s|4__
Teeed
aargh2
ac9f_
acetone_
anontor
b3t4f4c3__
bak83
dr4wd3
dr|z3d
duanin2
eyedeekay_bnc
leopold
makoto
nilbog
not_bob_afk
onon_
poriori
profetikla
qwer
r00tobo
rapidash
shiver_
solidx66
thetia
u5657
uop23ip
w8rabbit
x74a6
xHarr
hk If a length or data call is issued for an integer, should it attempt to recover by correcting it or return an error?
hk thank you
zzz huh?
orignal I assume he is asking what we do with messages with invalid lenght
orignal like too long or too short
hk zzz: sorry I mispoke, it's in regards to I2PStrings, not integers my bad
dr|z3d if go's anything like java, you may need null checks.
hk but the same principle applies, not messages sorry. If you create an i2p string programatically and the length is invalid, should it attempt to trim the data in attempt to recover and/or return an error
hk hm
dr|z3d if (string.length() > 10) {string = string.substring(0,7) + "...";}
hk nuyeah I see what you mean, whether to do that or return an error essentially
hk yeah*
dr|z3d depends on context, what you're doing.
dr|z3d maybe > 10 is invalid, then you'd want to drop it and print an error.
hk func (str I2PString) Data() (data string, err error) {
hk length, err := str.Length()
hk if err != nil {
hk switch err {
hk case ErrDataTooLong:
hk log.WithError(err).Warn("I2PString contains data beyond specified length")
hk data = string(str[1:])
hk //data = string(str[1 : length+1]) // Should we recover and trim?
hk return
zzz how would you know if what comes after is 'extra' or just the next field in the data structure?
zzz a: you don't
zzz the string tells you how long it is, it can't be "wrong"
hk understood
orignal really? first byte says 255 while length of remianing buffer is 100
orignal you must alway check this
zzz well you can never tell if 'too short' unless last item in the structure.
zzz sure it could be too long but presumably you have protection for that, that's not unique to strings, any field could be longer than what's remaining
zzz but no, you never try to "recover" by correcting something invalid
hk got it got it
zzz but doesn't Go do bounds checks on byte arrays so you can't overrun them, just like Java? eyedeekay?
zzz if so, I assume the best practice is to NOT explicitly check for overrun, let the panic equivalent of AIOOBE get thrown, and catch it higher up
zzz but that's up to you guys to come up with and adhere to a coding style
hk AIOOBE?