[ 
http://dev.sourcefabric.org/browse/LS-578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18247#action_18247
 ] 

David Baelde commented on LS-578:
---------------------------------

I grepped a little bit, noticed a few assert with side effects. Below is a list 
of potentially dangerous ones. Some are clearly VERY BAD (read/write/send), 
some are probably harmless (force), and some may be missing (please have a look 
at all uses of assert, see if you can spot more problematic ones).

$ hg grep assert . | grep "force\|alarm\|send\|write\|read\|to_s16le"
liquidsoap/src/stream/frame.ml:2569:            assert (match force with Some c 
-> c = content | None -> true) ;
liquidsoap/src/stream/frame.ml:2569:                    assert (match force 
with Some c -> c = content | None -> true) ;
liquidsoap/src/conversions/drop.ml:2555:      assert (layer_end = Lazy.force 
Frame.size) ;
liquidsoap/src/conversions/drop.ml:2555:      assert (layer_end = Lazy.force 
Frame.size) ;
liquidsoap/src/conversions/drop.ml:2555:      assert (layer_end = Lazy.force 
Frame.size) ;
ocaml-duppy/src/duppy.ml:2550:    assert(not (Mutex.try_lock s.ready_m)) ;
liquidsoap/src/conversions/mean.ml:2539:        assert (layer_end = Lazy.force 
Frame.size) ;
liquidsoap/src/io/oss_io.ml:2331:    assert (Unix.write fd s 0 r = r)
liquidsoap/src/outputs/graphics_out.ml:2331:        assert (stop = Lazy.force 
Frame.size) ;
liquidsoap/src/outputs/output.ml:2331:      assert (source#is_ready) ;
liquidsoap/src/outputs/output.ml:2331:          | [i] -> assert (i=Lazy.force 
Frame.size || not infallible)
liquidsoap/src/outputs/sdl_out.ml:2331:        assert (stop = Lazy.force 
Frame.size) ;
liquidsoap/src/operators/sequence.ml:2310:            assert (a#is_ready) ; (* 
Our #is_ready ensures that. *)
liquidsoap/src/operators/add.ml:2309:        assert (end_pos = Lazy.force 
Frame.size) ;
liquidsoap/src/protocols/mpd.ml:2309:      assert (Unix.send socket s 0 len [] 
= len)
liquidsoap/src/protocols/say.ml:2309:              assert (0 = Unix.alarm 
(int_of_float (maxtime -. time ()))) ;
liquidsoap/src/stream/aFrame.ml:2309:    assert (stop = Lazy.force size) ;
liquidsoap/src/stream/vFrame.ml:2309:        assert (stop = Lazy.force 
Frame.size) ;
ocaml-mm/external/ffmpeg/ffmpeg_stubs.c:2168:      
assert(av_write_frame(ffe->format_ctx, &pkt) == 0);
ocaml-mm/external/ffmpeg/ffmpeg_stubs.c:2168:            
assert(av_write_frame(ffe->format_ctx, &pkt) == 0);
ocaml-mm/src/IO.ml:2168:    assert (self#stream_write s 0 len = len)
ocaml-mm/src/audio.ml:2168:    assert (n <= read_space t);
ocaml-mm/src/audio.ml:2168:    assert (n <= write_space t);
ocaml-mm/src/audio.ml:2168:    assert (len <= read_space t);
ocaml-mm/src/audio.ml:2168:    assert (len <= write_space t);
ocaml-mm/src/ringbuffer.ml:2168:    assert (n <= read_space t);
ocaml-mm/src/ringbuffer.ml:2168:    assert (n <= write_space t);
ocaml-mm/src/ringbuffer.ml:2168:    assert (len <= read_space t);
ocaml-mm/src/ringbuffer.ml:2168:    assert (len <= write_space t);
liquidsoap/src/io/opal_io_c.c:1428:  assert(write(fd, &n, sizeof(int)) == 
sizeof(int));
liquidsoap/src/io/opal_io_c.c:1428:  assert(read(fd, &n, sizeof(int)) == 
sizeof(int));
liquidsoap/src/io/opal_io_c.c:1428:    assert(!pipe(write_fd));
liquidsoap/src/tools/ringbuffer.ml:1310:  assert (n <= read_space t) ;
liquidsoap/src/tools/ringbuffer.ml:1310:  assert (n <= write_space t) ;
liquidsoap/src/tools/ringbuffer.ml:1310:  assert (len <= read_space t) ;
liquidsoap/src/tools/ringbuffer.ml:1310:  assert (len <= write_space t) ;
liquidsoap/src/synth/synth.ml:1032:      assert (Unix.read fd s 0 n = n);
liquidsoap/src/formats/midiformat.ml:825:    assert (Unix.read fd buf 0 4 = 4);
liquidsoap/src/formats/midiformat.ml:825:    assert (Unix.read fd buf 0 n = n);
liquidsoap/src/stream/float_pcm.ml:755:      assert (n <= read_space t);
liquidsoap/src/stream/float_pcm.ml:755:      assert (n <= write_space t);
liquidsoap/src/stream/float_pcm.ml:755:      assert (len <= read_space t);
liquidsoap/src/stream/float_pcm.ml:755:      assert (len <= read_space t);
ocaml-jack/examples/simple_client/simple_client.ml:0:                 assert 
((Ringbuffer.Float.write outbuf buf 0 n) = n)
ocaml-jack/src/jack_stubs.c:0:  assert(!pthread_mutex_init(rb->mutex, NULL));
ocaml-jack/src/jack_stubs.c:0:  assert(!pthread_mutex_init(cc->buffer_mutex, 
NULL));
ocaml-jack/src/jack_stubs.c:0:  
assert(!pthread_cond_init(cc->buffer_data_ready, NULL));
ocaml-mad/src/mad.ml:0:      assert (n = Unix.read f ans 0 n) ;



> Review assert so that the code runs fine in -noassert
> -----------------------------------------------------
>
>                 Key: LS-578
>                 URL: http://dev.sourcefabric.org/browse/LS-578
>             Project: Liquidsoap
>          Issue Type: Bug
>            Reporter: David Baelde
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://dev.sourcefabric.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Savonet-devl mailing list
Savonet-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-devl

Répondre à