kaustuv changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
maxote has quit [Connection timed out]
struktured has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
komar_ has joined #ocaml
struktured_ has joined #ocaml
struktured has quit [Read error: 104 (Connection reset by peer)]
thelema has joined #ocaml
charlenopires has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
komar_ has joined #ocaml
Grissom has joined #ocaml
Grissom has left #ocaml []
charlenopires has quit [Read error: 104 (Connection reset by peer)]
hkBst has joined #ocaml
schme has quit ["leaving"]
schme has joined #ocaml
_zack has joined #ocaml
esope has joined #ocaml
rjones__ has joined #ocaml
Submarine has joined #ocaml
jeanbon has joined #ocaml
LeCamarade|Away is now known as LeCamarade
_zack has quit ["Leaving."]
Associat0r has quit ["#proglangdesign #ltu ##concurrency"]
Submarine has quit [Read error: 54 (Connection reset by peer)]
Submarine has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
jeanbon has quit [Read error: 104 (Connection reset by peer)]
_zack has joined #ocaml
jeanbon has joined #ocaml
Yoric[DT] has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
rjones__ has quit ["Closed connection"]
rwmjones_ has quit [Read error: 113 (No route to host)]
jmou has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
Traveler6 has joined #ocaml
rwmjones_ has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
slash_ has quit [Client Quit]
Amorphous has joined #ocaml
_andre has joined #ocaml
jmou is now known as julm
det has quit [Read error: 104 (Connection reset by peer)]
prigaux_ has joined #ocaml
prigaux has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has joined #ocaml
esope has quit [Remote closed the connection]
Traveler6 has quit ["Java user signed off"]
det has joined #ocaml
mishok13 has quit [Read error: 110 (Connection timed out)]
hkBst has joined #ocaml
bombshelter13_ has joined #ocaml
<rwmjones_> mehdid, gildor, _zack : what do you think of this patch? https://bugzilla.redhat.com/show_bug.cgi?id=509531#c4
<thelema> rwmjones_: oversized should use <= 0?
<thelema> well, I guess that would result in undersized, n/m
<_zack> rwmjones_: I confess I still need to read the details of the vuln, will do that in a bit
mishok13 has joined #ocaml
<_zack> in the meantime, have we tried other ways of getting in touch with authors? e.g. coworkers?
<thelema> I've been looking into catching arithmetic overflow, and this method doesn't look exact, although it may suffice for the current situation
<rwmjones_> thelema, basically if we get a PNG with width or height == 0, something funny's going on
<rwmjones_> thelema, the other way to do it is the way used in gnulib:
<rwmjones_> have a look at xalloc_oversized
<thelema> the right way is to use a 64-bit type to do the mult.
<thelema> and to check if the result is out of bounds
<_zack> for instance ... it looks like that Jun Furuse is now at Jane Street
<rwmjones_> but if the method in the patch works, it's easier to understand
* thelema wouldn't even consider xalloc_oversized's method
<thelema> performance isn't too critical here, no? this is a 'once per PNG open' function, right?
<thelema> because the -2, but the idea of dividing is sound.
* thelema doesn't like because the -2
<rwmjones_> performance is not critical at all here
<thelema> ocaml batteries currently divides. It's more expensive than various bit-twiddling tricks, but it's sound.
<thelema> you'll need a max_int constant.
<thelema> (to divide)
<_zack> rwmjones_: the patch looks fine to me (but I haven't verified if all occurrences have been catched), still I disagree that multiplying in 64-bit and then checking if there is an overflow would be harder to understand
<thelema> I'd recommend not using the [-1 -> unsigned] trick.
<_zack> why you think it will be less clear?
<_zack> (maybe it'll be less efficient, but that's a different story)
<rwmjones_> well, I'm going to push that patch as-is to Fedora now, and if anyone comes up with a better one, I'll push that later ...
<thelema> int division is expensive. The current hack is just that - a hack.
<thelema> but if X and Y are 32-bit values, it's not difficult to have an overflowed multiply be less than each of them.
<thelema> your test for overflow is only probabilistic, thus no good.
<rwmjones_> thelema, can you give a counterexample?
<thelema> for example: (2^32 -2) * (2^32 -2)
<thelema> I'm testing this at the moment
<thelema> but I'd be really surprised if the result mod 2^32 was 2^32-1
<rwmjones_> I don't understand - (2^32-2) * (2^32-2) == 0xFFFFFFFE * 0xFFFFFFFE == 4 (mod 2^32)
<rwmjones_> so my test would catch that case
<thelema> sorry, I misunderstood. hmmm...
<thelema> I'm still sure it's possible.
* thelema investigates around 0x7FFFFFFF
<thelema> 0x4000001 ^2 = 1000000080000001 = 80000001 (mod 2^32)
bombshelter13_ has quit []
bombshelter13_ has joined #ocaml
<thelema> 0x1_1000 ^2 = 0x121000000 -> 0x21000000
* thelema should have investigated closer to sqrt(2^32) sooner
<thelema> That's only a picture 69_632 by 69_632 pixels.
<rwmjones_> thelema, fair enough, so what's a better test?
<thelema> 1) use an int64
<thelema> 2) if max_int / x > y then overflow
<thelema> err, (max_int / (x) > (y))
<mrvn> don't forget that ocaml uses less bits for ints
<thelema> I think the problems are entirely within the C part of camlgraphics
<rwmjones_> gildor, _zack, mehdid: how about this? https://bugzilla.redhat.com/show_bug.cgi?id=509531#c9
<rwmjones_> thelema, we're calling into caml_alloc, but I can't find a coherent explanation anywhere as to what limits this function might have
<thelema> This test looks good to me.
<_zack> rwmjones_: trusting the overflow testing experts :) ... it looks good to me
<_zack> rwmjones_ notw that the CVE is not confirmed yet
<_zack> s/notw/note/
<rwmjones_> _zack, the vulnerability very much exists
<_zack> rwmjones_ sure, just pointing out that the number might be bogus
<rwmjones_> oh I see
beanjon has joined #ocaml
<_zack> I very much doubt they reuse assigned numbers, but I don't know the inner workings of CVE masters
struktured_ is now known as struktured
beanjon_ has joined #ocaml
jeanbon has quit [Nick collision from services.]
beanjon_ has left #ocaml []
struktured has quit [Read error: 60 (Operation timed out)]
beanjon has quit [Read error: 110 (Connection timed out)]
<rwmjones_> gildor, _zack, mehdid: another update: https://bugzilla.redhat.com/show_bug.cgi?id=509531#c11
<thelema> rwmjones_: definitely important to use safe ints for this kind of thing
ertai has quit [Read error: 104 (Connection reset by peer)]
jeddhaberstro has joined #ocaml
mishok13 has quit ["Stopping IRC chat... [OK]"]
rwmjones_ has quit [Read error: 110 (Connection timed out)]
dabd has joined #ocaml
Submarine has quit [Remote closed the connection]
sporkmonger has joined #ocaml
<_andre> in programs using the Toplevel module, is it possible somehow to use its generic printing function?
<_andre> i don't see anything in the interface files, so i'm guessing it isn't...
<C_Tux> _andre: what do you mean with "generic printing" ?
dabd has quit [Client Quit]
<_andre> well, the toplevel can print results of any type
<C_Tux> hmmm : "- : out_channel = <abstr>"
rwmjones_ has joined #ocaml
<_andre> that's ok, what i mean is that it works for any type
_zack has quit ["Leaving."]
<_andre> toploop.ml uses stuff from modules Typemod, Printtyp, etc
<_andre> i'm not sure that's available to use
<julm> _andre: have you had a glance at toplevellib.cma?
<_andre> julm: no, is there any documentation for it?
<_andre> or some mli file :)
<julm> I can't find one.. except the sources..
<_andre> outval_of_value in genprintval.ml looks like it...
<_andre> i wonder if it's exported
<julm> try to use cmigrep on the .cma
<_andre> cmigrep, that's new to me :)
<_andre> there's actually this in toploop.mli
<_andre> val print_value: Env.t -> Obj.t -> formatter -> Types.type_expr -> unit
<julm> I don't know how you can get the Env.t and the Types.type_expr..
<_andre> neither do i :(
Yoric[DT] has quit ["Ex-Chat"]
<_andre> and i don't think there would be a need for Std.dump in extlib if that was possible at all...
_zack has joined #ocaml
<_andre> it seems i can get the Env.t with Toploop.toplevel_env
C_Tux is now known as DobbsHead
_PenPen_ has joined #ocaml
<thelema> _andre: you don't like Std.dump?
<_andre> thelema: i was in search of something to use in ospec, and Std.dump doesn't have enough type information, so things like [], None and 0 are all represented as 0
<_andre> which can be quite confusing in a testing library output...
<thelema> That's the best that can be done - what did you want?
<_andre> i was hoping i could use the Toploop module and do whatever the toplevel does to print its output
<thelema> the toplevel cheats because it knows the types of values
<_andre> yeah, i wanted to do the same cheat :)
<thelema> during compilation, types are erased, so at runtime, there's no type information.
<thelema> you'd have to write your own runtime that preserves type information
<_andre> because my program is actually a kind of toplevel
<_andre> i run code through Toploop.execute_phrase
<_andre> so i was hoping i could access that type information somehow
Associat0r has joined #ocaml
DobbsHead is now known as C_Tux
itewsh has joined #ocaml
xwm__ has joined #ocaml
xwm__ has quit [Client Quit]
kig has quit ["leaving"]
LeCamarade is now known as LeCamarade|Away
Submarine has joined #ocaml
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
julm has quit [Read error: 104 (Connection reset by peer)]
julm has joined #ocaml
_zack has quit [Read error: 113 (No route to host)]
Yoric[DT] has joined #ocaml
astie has joined #ocaml
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
mgodshal1 has joined #ocaml
julm has quit [Read error: 113 (No route to host)]
_andre has quit ["leaving"]
mgodshall has quit [Read error: 110 (Connection timed out)]
esope has joined #ocaml
jeddhaberstro has quit []
julm has joined #ocaml
esope has quit ["Leaving."]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
C_Tux is now known as MichaelJackson
MichaelJackson is now known as C_Tux
bombshelter13_ has quit []
maxote2 has joined #ocaml
slash_ has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
maxote2 is now known as maxote
maskd- has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
maskd- is now known as maskd
hkBst has quit [Read error: 104 (Connection reset by peer)]
Submarine has quit [Read error: 110 (Connection timed out)]
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
astie has quit [Client Quit]
Yoric[DT] has quit ["Ex-Chat"]
_PenPen_ has quit ["Leaving"]
komar_ has joined #ocaml
thelema has quit [Read error: 110 (Connection timed out)]
slash_ has quit [Client Quit]
Associat0r has quit ["#proglangdesign #ltu ##concurrency"]