Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #10412 > unrolled thread

Testing if a pointer is valid

Started byjacob navia <jacob@spamsink.net>
First post2011-09-18 00:29 +0200
Last post2011-09-20 00:22 -0700
Articles 20 on this page of 284 — 42 participants

Back to article view | Back to comp.lang.c


Contents

  Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-18 00:29 +0200
    Re: Testing if a pointer is valid Harald van Dijk <truedfx@gmail.com> - 2011-09-17 15:38 -0700
      Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-18 00:57 +0200
        Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-18 16:30 +0000
          Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-18 19:25 +0200
            Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-19 07:53 +1200
            Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-18 20:00 +0000
              Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-19 08:23 +1200
                Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-18 20:32 +0000
                  Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-18 23:28 +0000
                    Re: Testing if a pointer is valid blp@cs.stanford.edu (Ben Pfaff) - 2011-09-18 16:38 -0700
                      Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 04:27 +0000
                        Re: Testing if a pointer is valid blp@cs.stanford.edu (Ben Pfaff) - 2011-09-18 21:48 -0700
                          Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 05:38 +0000
                            Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-19 09:14 +0200
                              Re: Testing if a pointer is valid "BartC" <bc@freeuk.com> - 2011-09-19 10:10 +0100
                              Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-19 05:07 -0700
                              Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-19 14:24 +0100
                                Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-19 16:10 +0200
                              Re: Testing if a pointer is valid "BartC" <bc@freeuk.com> - 2011-09-19 16:50 +0100
                            Re: Testing if a pointer is valid Ben Pfaff <blp@cs.stanford.edu> - 2011-09-19 08:11 -0700
                              Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-19 17:21 +0200
                              Re: Testing if a pointer is valid "BartC" <bc@freeuk.com> - 2011-09-19 16:27 +0100
                                Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-19 10:14 -0700
                                  Re: Testing if a pointer is valid "BartC" <bc@freeuk.com> - 2011-09-19 19:56 +0100
                                    Re: Testing if a pointer is valid blp@cs.stanford.edu (Ben Pfaff) - 2011-09-19 13:20 -0700
                                    Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-20 18:31 +0300
                                      Re: Testing if a pointer is valid "BartC" <bc@freeuk.com> - 2011-09-20 17:44 +0100
                                        Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-20 17:06 -0700
                                          Re: Testing if a pointer is valid "BartC" <bc@freeuk.com> - 2011-09-21 01:37 +0100
                                        Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-22 22:03 +0300
                                    Re: Testing if a pointer is valid Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-28 02:33 -0700
                                  Re: Testing if a pointer is valid ImpalerCore <jadill33@gmail.com> - 2011-09-19 13:01 -0700
                                    Re: Testing if a pointer is valid ImpalerCore <jadill33@gmail.com> - 2011-09-19 14:42 -0700
                                      Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-20 10:08 +1200
                                        Re: Testing if a pointer is valid ImpalerCore <jadill33@gmail.com> - 2011-09-20 07:55 -0700
                              Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 16:39 +0000
                                Re: Testing if a pointer is valid blp@cs.stanford.edu (Ben Pfaff) - 2011-09-19 09:48 -0700
                              Re: Testing if a pointer is valid ImpalerCore <jadill33@gmail.com> - 2011-09-19 12:49 -0700
                                Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-19 22:45 +0200
                                  Re: Testing if a pointer is valid ImpalerCore <jadill33@gmail.com> - 2011-09-19 14:02 -0700
                        Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-19 07:14 +0000
                          Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 16:13 +0000
                            Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-19 17:36 +0000
                              Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 20:09 +0000
                          Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-19 20:36 +0200
                            Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-20 08:05 +1200
                            Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 20:18 +0000
                              Re: Testing if a pointer is valid Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-19 23:37 +0000
                              Re: Testing if a pointer is valid Kenneth Brody <kenbrody@spamcop.net> - 2011-09-21 12:23 -0400
                            Re: Testing if a pointer is valid Kenneth Brody <kenbrody@spamcop.net> - 2011-09-21 12:09 -0400
                      Re: Testing if a pointer is valid websnarf <websnarf@gmail.com> - 2011-09-26 22:01 -0700
                    Re: Testing if a pointer is valid Kenneth Brody <kenbrody@spamcop.net> - 2011-09-19 13:51 -0400
                      Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 20:11 +0000
                    Re: Testing if a pointer is valid Nobody <nobody@nowhere.com> - 2011-09-19 22:21 +0100
                      Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-20 00:05 +0000
            Re: Testing if a pointer is valid Nobody <nobody@nowhere.com> - 2011-09-18 23:34 +0100
            Re: Testing if a pointer is valid pacman@kosh.dhis.org (Alan Curry) - 2011-09-18 22:47 +0000
            Re: Testing if a pointer is valid tom st denis <tom@iahu.ca> - 2011-09-19 04:50 -0700
            Re: Testing if a pointer is valid Kenneth Brody <kenbrody@spamcop.net> - 2011-09-19 13:42 -0400
              Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-19 20:30 +0200
                Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-20 08:09 +1200
                  Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-19 22:38 +0200
                    Re: Testing if a pointer is valid Ike Naar <ike@iceland.freeshell.org> - 2011-09-19 20:50 +0000
                      Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-19 22:53 +0200
                        Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-19 22:30 +0100
                          Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-20 00:05 +0200
                            Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-20 00:31 +0100
                        Re: Testing if a pointer is valid Ike Naar <ike@iceland.freeshell.org> - 2011-09-19 22:43 +0000
                          Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-20 00:59 +0200
                            Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-20 11:50 +1200
                              Re: Testing if a pointer is valid blp@cs.stanford.edu (Ben Pfaff) - 2011-09-19 19:03 -0700
                                Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-20 14:11 +1200
                              Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-19 21:49 -0700
                              Re: Testing if a pointer is valid Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-28 06:17 -0700
                                Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-28 07:02 -0700
                            Re: Testing if a pointer is valid Ike Naar <ike@sverige.freeshell.org> - 2011-09-20 07:26 +0000
                            Re: Testing if a pointer is valid Kenneth Brody <kenbrody@spamcop.net> - 2011-09-21 12:31 -0400
                      Re: Testing if a pointer is valid Kenneth Brody <kenbrody@spamcop.net> - 2011-09-21 12:26 -0400
                        Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-21 21:20 +0200
                          Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-21 19:40 +0000
                          Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-22 07:46 +1200
                        Re: Testing if a pointer is valid "Rosario Pulvirenti" <NoInUseno1Spam@non.usare.invalid> - 2011-09-22 07:38 +0200
                    Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-20 09:05 +1200
                Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-20 07:16 +0000
                  Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-20 09:50 +0200
                    Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-20 10:38 +0000
                      Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-20 04:29 -0700
                        Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-20 12:04 +0000
                          Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-20 05:25 -0700
                            Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-20 16:49 +0000
                              Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-22 22:35 +0300
                                Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-23 07:59 +0000
                                  Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-23 12:33 +0300
                                    Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-23 12:23 +0000
                                      Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-23 17:34 +0300
                                        Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-23 17:08 +0000
                                  Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-23 06:49 -0400
                                    Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-23 12:20 +0000
                                      Re: Testing if a pointer is valid Seebs <usenet-nospam@seebs.net> - 2011-09-26 22:59 +0000
                            Re: Testing if a pointer is valid Michael Press <rubrum@pacbell.net> - 2011-09-30 01:27 -0700
                              Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-30 08:38 +0000
                                Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-10-04 12:40 +0000
                Re: Testing if a pointer is valid Kenneth Brody <kenbrody@spamcop.net> - 2011-09-21 12:00 -0400
                  Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-21 21:17 +0200
          Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-18 23:21 +0000
            Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-18 17:32 -0700
              Re: Testing if a pointer is valid Joe Wright <joewwright@comcast.net> - 2011-09-18 23:10 -0400
                Re: Testing if a pointer is valid gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-19 03:34 +0000
                  Re: Testing if a pointer is valid Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-09-18 22:32 -0600
                    Re: Testing if a pointer is valid gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-20 14:18 +0000
                      Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-20 18:15 +0200
                        Re: Testing if a pointer is valid "BartC" <bc@freeuk.com> - 2011-09-20 17:49 +0100
                          Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-20 17:02 +0000
                            Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-20 20:35 +0200
                              Re: Testing if a pointer is valid Ike Naar <ike@iceland.freeshell.org> - 2011-09-20 20:30 +0000
                                Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-20 22:35 +0200
                                Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-22 22:07 +0300
                                  Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-22 16:11 -0400
                                    Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-23 12:28 +0300
                                      Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-23 06:44 -0400
                                        Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-23 17:33 +0300
                                          Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-23 11:31 -0400
                                            Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-23 20:09 +0200
                                          Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-23 20:02 +0200
                                            Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-23 13:49 -0700
                                              Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-24 09:01 +1200
                                                Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-23 23:08 +0200
                                                  Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-24 09:43 +1200
                                                Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-23 22:13 +0100
                                                  Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-23 23:45 +0200
                                                    Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-24 00:01 +0100
                                                  Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-24 09:47 +1200
                                                Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-23 17:22 -0400
                                                  Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-23 23:47 +0200
                                                  Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-24 09:50 +1200
                                                    Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-23 18:06 -0400
                                                      Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-24 10:25 +1200
                                                        Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-24 08:02 -0400
                                                          Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-24 14:13 +0200
                                                            Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-24 14:07 +0100
                                                          Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-24 13:15 +0000
                                                            Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-24 15:20 +0100
                                                            Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-24 11:28 -0400
                                                              Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-24 15:45 +0000
                                                                Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-24 20:07 +0300
                                                                  Re: Testing if a pointer is valid Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-24 14:31 -0400
                                                                    Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-24 21:49 +0100
                                                                      Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-24 14:40 -0700
                                                                        Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-25 01:14 +0100
                                                                          Re: Testing if a pointer is valid Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-24 13:44 -0800
                                                                      Re: Testing if a pointer is valid Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-24 20:23 -0400
                                                                  Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-24 18:44 +0000
                                                                Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-25 07:04 -0400
                                                              Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-24 17:30 +0000
                                                              Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-24 12:34 -0700
                                                                Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-25 01:00 -0700
                                                                  Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-25 21:30 +1300
                                                                    Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-25 05:08 -0700
                                                                      Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-26 08:39 +1300
                                                      Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-24 20:04 +0300
                                              Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-23 17:09 -0400
                                                Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-23 23:43 +0200
                                      Re: Testing if a pointer is valid Michael Press <rubrum@pacbell.net> - 2011-09-27 20:48 -0700
                                        Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-10-03 19:59 +0300
                                          Re: Testing if a pointer is valid Michael Press <rubrum@pacbell.net> - 2011-10-03 17:32 -0700
                                  Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-24 13:53 +0100
                            Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-20 21:18 +0100
                              Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-20 20:35 +0000
                                Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-20 22:45 +0200
                                  Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-21 08:09 +0000
                                    Re: Testing if a pointer is valid Noob <root@127.0.0.1> - 2011-09-22 13:04 +0200
                                      Re: Testing if a pointer is valid Robert Wessel <robertwessel2@yahoo.com> - 2011-09-22 11:38 -0500
                                        Re: Testing if a pointer is valid Noob <root@127.0.0.1> - 2011-09-23 10:41 +0200
                                    Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-22 22:20 +0300
                                      Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-22 22:15 +0000
                                        Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-23 12:30 +0300
                                      Re: Testing if a pointer is valid Seebs <usenet-nospam@seebs.net> - 2011-09-26 22:59 +0000
                                        Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-27 02:06 +0100
                                          Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-27 03:39 +0000
                                            Re: Testing if a pointer is valid "Rosario Pulvirenti" <NoInUseno1Spam@non.usare.invalid> - 2011-10-03 19:51 +0200
                                              Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-10-03 19:11 +0100
                                                Re: Testing if a pointer is valid "Rosario Pulvirenti" <NoInUseno1Spam@non.usare.invalid> - 2011-10-04 16:20 +0200
                                            Re: Testing if a pointer is valid China Blue Corn Chips <chine.bleu@yahoo.com> - 2011-10-04 08:11 -0700
                                              Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-10-04 12:19 -0400
                                          Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-27 13:56 +0300
                                            Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-27 13:13 +0100
                                        Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-27 12:08 +0300
                                    Re: Testing if a pointer is valid Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-29 01:00 -0700
                                Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-20 21:59 +0100
                                Re: Testing if a pointer is valid Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-22 22:08 +0300
                        Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-20 17:00 +0000
                          Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-20 20:32 +0200
                            Re: Testing if a pointer is valid gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-20 18:53 +0000
                              Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-20 22:55 +0200
                              Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-20 21:50 +0100
                                Re: Testing if a pointer is valid gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-21 15:48 +0000
                                  Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-21 16:12 +0000
                                    Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-21 09:42 -0700
                                      Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-21 18:01 +0000
                                  Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-21 21:00 +0100
                                Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-21 21:32 +0200
                                  Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-22 12:40 +0100
                                    Re: Testing if a pointer is valid gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-22 13:00 +0000
                                      Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-22 14:54 +0100
                                        Re: Testing if a pointer is valid gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-22 14:03 +0000
                                        Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-22 11:39 -0700
                                          Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-24 13:44 +0100
                                            Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-24 12:23 -0700
                                      Re: Testing if a pointer is valid Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-29 04:52 -0700
                                    Re: Testing if a pointer is valid Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-29 04:51 -0700
                            Re: Testing if a pointer is valid Willem <willem@toad.stack.nl> - 2011-09-20 19:32 +0000
                              Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-20 22:48 +0200
                                Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-20 17:29 -0400
                                  Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-20 23:45 +0200
                                    Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-21 10:35 -0400
                                      Re: Testing if a pointer is valid Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-29 05:04 -0700
                                Re: Testing if a pointer is valid Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-29 04:54 -0700
                            Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-20 17:19 -0700
                              Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-21 23:26 +0200
                                Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-21 14:35 -0700
                                  Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-22 00:09 +0200
                                    Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-21 19:08 -0400
                            Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-21 05:25 +0000
                        Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-20 21:11 +0100
                          Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-20 23:01 +0200
                            Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-21 03:11 -0700
                              Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-21 12:16 +0200
                                Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-21 03:23 -0700
                            Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-21 20:44 +0100
                              Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-21 22:53 +0200
                                Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-21 23:08 -0400
                                  Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-21 21:14 -0700
                                    Re: Testing if a pointer is valid James Kuyper <jameskuyper@verizon.net> - 2011-09-22 07:17 -0400
                                  Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-22 16:37 +0100
                                Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-22 16:25 +0100
                                  Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-22 11:36 -0700
                                    Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-24 13:37 +0100
                                      Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-24 13:50 +0000
                                        Re: Testing if a pointer is valid gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-24 14:47 +0000
                                          Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-24 20:43 +0100
                                        Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-24 20:26 +0100
                                        Re: Testing if a pointer is valid Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-24 20:53 -0400
                                          Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-25 02:30 +0100
                                            Re: Testing if a pointer is valid Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-24 22:24 -0400
                                              Re: Testing if a pointer is valid Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-25 12:36 +0100
                              Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-21 13:56 -0700
                                Re: Testing if a pointer is valid "Rosario Pulvirenti" <NoInUseno1Spam@non.usare.invalid> - 2011-09-22 07:38 +0200
                                  Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-22 02:06 -0700
                                Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-22 15:24 +0100
                                  Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-22 11:35 -0700
                                    Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-24 13:25 +0100
                                Re: Testing if a pointer is valid Seebs <usenet-nospam@seebs.net> - 2011-09-26 22:59 +0000
                                  Re: Testing if a pointer is valid Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-24 13:30 -0800
                              Re: Testing if a pointer is valid Nobody <nobody@nowhere.com> - 2011-09-22 18:23 +0100
                          Re: Testing if a pointer is valid gazelle@shell.xmission.com (Kenny McCormack) - 2011-09-21 15:40 +0000
                            Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-21 20:20 +0100
                Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-19 06:39 +0000
                  Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-19 10:06 -0700
                    Re: Testing if a pointer is valid Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-09-20 07:03 +0000
                Re: Testing if a pointer is valid pete <pfiland@mindspring.com> - 2011-09-19 19:17 -0400
                Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-20 20:57 +0100
              Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 05:14 +0000
                Re: Testing if a pointer is valid Ian Collins <ian-news@hotmail.com> - 2011-09-19 18:02 +1200
                  Re: Testing if a pointer is valid cri@tiac.net (Richard Harter) - 2011-09-19 06:18 +0000
              Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-19 17:50 +0200
                Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-19 20:45 +0200
              Re: Testing if a pointer is valid Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-28 08:05 -0700
                Re: Testing if a pointer is valid Keith Thompson <kst-u@mib.org> - 2011-09-28 09:14 -0700
            Re: Testing if a pointer is valid Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-18 23:52 -0700
            Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-20 20:45 +0100
              Re: Testing if a pointer is valid August Karlstrom <fusionfile@gmail.com> - 2011-09-20 23:35 +0200
                Re: Testing if a pointer is valid Rui Maciel <rui.maciel@gmail.com> - 2011-09-21 19:53 +0100
    Re: Testing if a pointer is valid "BartC" <bc@freeuk.com> - 2011-09-17 23:54 +0100
      Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-18 00:59 +0200
    Re: Testing if a pointer is valid Heikki Kallasjoki <fis+usenet@zem.fi> - 2011-09-17 23:35 +0000
      Re: Testing if a pointer is valid jacob navia <jacob@spamsink.net> - 2011-09-18 01:47 +0200
    Re: Testing if a pointer is valid Geoff <geoff@invalid.invalid> - 2011-09-17 17:15 -0700
    Re: Testing if a pointer is valid Максим Фомин <maxim@maxim-fomin.ru> - 2011-09-18 00:43 -0700
    Re: Testing if a pointer is valid "Rosario Pulvirenti" <NoInUseno1Spam@non.usare.invalid> - 2011-09-18 10:34 +0200
      Re: Testing if a pointer is valid "Rosario Pulvirenti" <NoInUseno1Spam@non.usare.invalid> - 2011-09-20 09:28 +0200
    Re: Testing if a pointer is valid Ike Naar <ike@iceland.freeshell.org> - 2011-09-18 12:55 +0000
    Re: Testing if a pointer is valid "Joel C. Salomon" <joelcsalomon@gmail.com> - 2011-09-19 10:29 -0400
    Re: Testing if a pointer is valid China Blue Corn Chips <chine.bleu@yahoo.com> - 2011-09-20 00:22 -0700

Page 1 of 15  [1] 2 3 … 15  Next page →


#10412 — Testing if a pointer is valid

Fromjacob navia <jacob@spamsink.net>
Date2011-09-18 00:29 +0200
SubjectTesting if a pointer is valid
Message-ID<j5370i$1nv$1@speranza.aioe.org>
In a recent discussion about preconditions, I argued that testing ALL 
preconditions would be unpractical. As an example of a precondition
impossible to test I presented the problem to know if a pointer
points to a really readable place in memory.

The windows API provides the function
bool IsBadReadPtr(const void *lp, size_t ucb);

This takes a pointer and a size and returns true if it is OK, zero
if it fails.

Problem is, that is only present under windows.

But after doing some research, I found the following equivalent,
written in almost standard C.
---------------------------------------------------------cut here
/* Heavily adapted from:
    http://fixunix.com/linux/337646-isbadreadptr-linux.html */
#include <setjmp.h>
#include <signal.h>
static int PtrTestInstalled;
static jmp_buf PtrTestJmpBuf;
static void PtrTestHandler(int nSig)
{
         if (PtrTestInstalled)
                 longjmp(PtrTestJmpBuf, 1);
}

int IsBadReadPtr(void* lp, size_t ObjectSize)
{
         size_t i;
         volatile unsigned char c;
         int r  = 1;
         void (* PrevHandler)(int);
         PtrTestInstalled = 1;
         if (setjmp(PtrTestJmpBuf)) {
                 r = 0;
                 goto Ret;
         }
         PrevHandler = signal(SIGSEGV, PtrTestHandler);

         for (i = 0; i < ObjectSize; i ++)
                 c = ((unsigned char*)lp)[i];
Ret:
         PtrTestInstalled        = 0;
         signal(SIGSEGV, PrevHandler);

         return r;
}
--------------------------------------------------------cut here

This looks like a promising stuff. The only non-standard
thing here is the SIGSEGV constant. That constant is not
in the standard but defined under windows, linux, and
most  Unix variants.
Does anybody see any potentially non-standard stuff here?

Thanks

[toc] | [next] | [standalone]


#10413

FromHarald van Dijk <truedfx@gmail.com>
Date2011-09-17 15:38 -0700
Message-ID<485d26ed-8e0c-4ad2-92de-ac71961b75dd@17g2000yqv.googlegroups.com>
In reply to#10412
On Sep 18, 12:29 am, jacob navia <ja...@spamsink.net> wrote:
> In a recent discussion about preconditions, I argued that testing ALL
> preconditions would be unpractical. As an example of a precondition
> impossible to test I presented the problem to know if a pointer
> points to a really readable place in memory.
>
> The windows API provides the function
> bool IsBadReadPtr(const void *lp, size_t ucb);
>
> This takes a pointer and a size and returns true if it is OK, zero
> if it fails.
>
> Problem is, that is only present under windows.

That is not its biggest problem. Even on Windows, don't use it. Please
read
  <http://blogs.msdn.com/b/oldnewthing/archive/2006/09/27/773741.aspx>
for reasons why the concept of IsBadReadPtr (and IsBadWritePtr even
more so) is fundamentally flawed.

[toc] | [prev] | [next] | [standalone]


#10415

Fromjacob navia <jacob@spamsink.net>
Date2011-09-18 00:57 +0200
Message-ID<j538ks$6ae$1@speranza.aioe.org>
In reply to#10413
Le 18/09/11 00:38, Harald van Dijk a écrit :
> On Sep 18, 12:29 am, jacob navia<ja...@spamsink.net>  wrote:
>> In a recent discussion about preconditions, I argued that testing ALL
>> preconditions would be unpractical. As an example of a precondition
>> impossible to test I presented the problem to know if a pointer
>> points to a really readable place in memory.
>>
>> The windows API provides the function
>> bool IsBadReadPtr(const void *lp, size_t ucb);
>>
>> This takes a pointer and a size and returns true if it is OK, zero
>> if it fails.
>>
>> Problem is, that is only present under windows.
>
> That is not its biggest problem. Even on Windows, don't use it. Please
> read
>    <http://blogs.msdn.com/b/oldnewthing/archive/2006/09/27/773741.aspx>
> for reasons why the concept of IsBadReadPtr (and IsBadWritePtr even
> more so) is fundamentally flawed.

They aren't "flawed". They just could interfere with guard pages. The
solution is very easy: You call (before the loop) a virtual memory
status function and see if you are going to touch a guard page. I know
that such an API exists since I used it in the debugger a lot.

I was unable to know where a function pointer was really pointing and
wanted to implement the "step" command. That was easy: I read the memory
rights of the pages of the program and set all the code pages to
NOACCESS. That way the program would crash after the jump, I would get
called (since I am the debugger!)and I would reset the page rights, see 
where the program landed, and continue happily the debugging.

[toc] | [prev] | [next] | [standalone]


#10440

FromKleuskes & Moos <kleuske@somewhere.else.net>
Date2011-09-18 16:30 +0000
Message-ID<j556ad$3fm$2@dont-email.me>
In reply to#10415
On Sun, 18 Sep 2011 00:57:32 +0200, jacob navia wrote:

> Le 18/09/11 00:38, Harald van Dijk a écrit :
>> On Sep 18, 12:29 am, jacob navia<ja...@spamsink.net>  wrote:
>>> In a recent discussion about preconditions, I argued that testing ALL
>>> preconditions would be unpractical. As an example of a precondition
>>> impossible to test I presented the problem to know if a pointer points
>>> to a really readable place in memory.
>>>
>>> The windows API provides the function bool IsBadReadPtr(const void
>>> *lp, size_t ucb);
>>>
>>> This takes a pointer and a size and returns true if it is OK, zero if
>>> it fails.
>>>
>>> Problem is, that is only present under windows.
>>
>> That is not its biggest problem. Even on Windows, don't use it. Please
>> read
>>    <http://blogs.msdn.com/b/oldnewthing/archive/2006/09/27/773741.aspx>
>> for reasons why the concept of IsBadReadPtr (and IsBadWritePtr even
>> more so) is fundamentally flawed.
> 
> They aren't "flawed".

If you need code to check whether or not a pointer is valid, _your code_
is fundamentally flawed.

-------------------------------------------------------------------------------
 _________________________________________
< I joined scientology at a garage sale!! >
 -----------------------------------------
  \
   \
       ___  
     {~._.~}
      ( Y )
     ()~*~()   
     (_)-(_)   
-------------------------------------------------------------------------------

[toc] | [prev] | [next] | [standalone]


#10441

Fromjacob navia <jacob@spamsink.net>
Date2011-09-18 19:25 +0200
Message-ID<j559ir$np9$1@speranza.aioe.org>
In reply to#10440
Le 18/09/11 18:30, Kleuskes & Moos a écrit :
>
> If you need code to check whether or not a pointer is valid, _your code_
> is fundamentally flawed.
>

Suppose a library that receives a bad pointer. Isn't it reasonable to
check its validity before using it?

You should have a way to avoid crashes because of malicious code that
feeds you a bad pointer isn't it?

Besides, my motivation here is that in principle I thought that this
would be impossible, but later on and reflecting a bit, I found out
that it is not that difficult. I am not advocating the usage of this
function everywhere.

Consider too the development environment where it is much more likely
that in the first versions of your software bugs still creep in or
bugs exist that are undetected.

Rather than simply crashing you could print some useful information,
jump to a recovery point and go on.

[toc] | [prev] | [next] | [standalone]


#10442

FromIan Collins <ian-news@hotmail.com>
Date2011-09-19 07:53 +1200
Message-ID<9dn0h4Fr5dU6@mid.individual.net>
In reply to#10441
On 09/19/11 05:25 AM, jacob navia wrote:
> Le 18/09/11 18:30, Kleuskes&  Moos a écrit :
>>
>> If you need code to check whether or not a pointer is valid, _your code_
>> is fundamentally flawed.
>>
>
> Suppose a library that receives a bad pointer. Isn't it reasonable to
> check its validity before using it?

If the check is reliable, yes.

> You should have a way to avoid crashes because of malicious code that
> feeds you a bad pointer isn't it?

If the check is reliable, yes.  There simply isn't a portable, reliable 
way to do this.

> Besides, my motivation here is that in principle I thought that this
> would be impossible, but later on and reflecting a bit, I found out
> that it is not that difficult. I am not advocating the usage of this
> function everywhere.

It is impossible to have a portable solution.  Say for example you have 
some form of copy function:

void copy( const char* src, char* dst, size_t size );

How could you detect something like

int a,b,c;
char buf[4];
int d,e,f;

copy( "this is too big" , buf, 20 );

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#10443

FromKleuskes & Moos <kleuske@somewhere.else.net>
Date2011-09-18 20:00 +0000
Message-ID<j55ikl$e68$1@dont-email.me>
In reply to#10441
On Sun, 18 Sep 2011 19:25:49 +0200, jacob navia wrote:

> Le 18/09/11 18:30, Kleuskes & Moos a écrit :
>>
>> If you need code to check whether or not a pointer is valid, _your
>> code_ is fundamentally flawed.
>>
>>
> Suppose a library that receives a bad pointer. Isn't it reasonable to
> check its validity before using it?

Nope. If you feed a badpointer to the library, a crash ensues, since the
programmer screwed up. Masking that by attempting to return a polite
error message masks a serious problem.

> You should have a way to avoid crashes because of malicious code that
> feeds you a bad pointer isn't it?

You should not be uncertain wether or not a pointer is valid or not. If
you are, your design stinks. If you try to compensate by adding checks,
your methodology stinks, too.

> Besides, my motivation here is that in principle I thought that this
> would be impossible, but later on and reflecting a bit, I found out that
> it is not that difficult. I am not advocating the usage of this function
> everywhere.

Good.

> Consider too the development environment where it is much more likely
> that in the first versions of your software bugs still creep in or bugs
> exist that are undetected.

Then the program crashes and it's time you fire up your debugger. If there
is a debugger available, that is.

> Rather than simply crashing you could print some useful information,
> jump to a recovery point and go on.

That's what debuggers are for. Trying to duplicate that functionality in code
is both superfluous *and* dangerous. It tends to mask serious problems in the
design.

-------------------------------------------------------------------------------
 _____________________________________
/ Oh, I get it!! "The BEACH goes on", \
\ huh, SONNY??                        /
 -------------------------------------
  \
   \
       ___  
     {~._.~}
      ( Y )
     ()~*~()   
     (_)-(_)   
-------------------------------------------------------------------------------

[toc] | [prev] | [next] | [standalone]


#10444

FromIan Collins <ian-news@hotmail.com>
Date2011-09-19 08:23 +1200
Message-ID<9dn2amFr5dU7@mid.individual.net>
In reply to#10443
On 09/19/11 08:00 AM, Kleuskes & Moos wrote:
> On Sun, 18 Sep 2011 19:25:49 +0200, jacob navia wrote:
>
>> You should have a way to avoid crashes because of malicious code that
>> feeds you a bad pointer isn't it?
>
> You should not be uncertain wether or not a pointer is valid or not. If
> you are, your design stinks. If you try to compensate by adding checks,
> your methodology stinks, too.

That's untrue.  How can a library designer know what a user will pass to 
one of their functions?

-- 
Ian Collins

[toc] | [prev] | [next] | [standalone]


#10445

FromKleuskes & Moos <kleuske@somewhere.else.net>
Date2011-09-18 20:32 +0000
Message-ID<j55kgc$e68$2@dont-email.me>
In reply to#10444
On Mon, 19 Sep 2011 08:23:50 +1200, Ian Collins wrote:

> On 09/19/11 08:00 AM, Kleuskes & Moos wrote:
>> On Sun, 18 Sep 2011 19:25:49 +0200, jacob navia wrote:
>>
>>> You should have a way to avoid crashes because of malicious code that
>>> feeds you a bad pointer isn't it?
>>
>> You should not be uncertain wether or not a pointer is valid or not. If
>> you are, your design stinks. If you try to compensate by adding checks,
>> your methodology stinks, too.
> 
> That's untrue.  How can a library designer know what a user will pass to
> one of their functions?

That's the users responsibility, not one the author of the library should
concern himself with. If the user passes crap to the library, a crash (or
at least a SIGSEGV) is what's called for.

The alternative is requiring complete checking of any pointer passed to any
library, thus penalizing those programs that pass valid pointers for the
benefit of programmers who can't be bothered to ensure their pointers are
valid.

That's not the proper way to do it. 

-------------------------------------------------------------------------------
 ___________________________
< Yow! Am I having fun yet? >
 ---------------------------
  \
   \
       ___  
     {~._.~}
      ( Y )
     ()~*~()   
     (_)-(_)   
-------------------------------------------------------------------------------

[toc] | [prev] | [next] | [standalone]


#10455

Fromcri@tiac.net (Richard Harter)
Date2011-09-18 23:28 +0000
Message-ID<4e767e68.282983130@text.giganews.com>
In reply to#10445
On Sun, 18 Sep 2011 20:32:12 +0000 (UTC), Kleuskes & Moos
<kleuske@somewhere.else.net> wrote:

>On Mon, 19 Sep 2011 08:23:50 +1200, Ian Collins wrote:
>
>> On 09/19/11 08:00 AM, Kleuskes & Moos wrote:
>>> On Sun, 18 Sep 2011 19:25:49 +0200, jacob navia wrote:
>>>
>>>> You should have a way to avoid crashes because of malicious code that
>>>> feeds you a bad pointer isn't it?
>>>
>>> You should not be uncertain wether or not a pointer is valid or not. If
>>> you are, your design stinks. If you try to compensate by adding checks,
>>> your methodology stinks, too.
>> 
>> That's untrue.  How can a library designer know what a user will pass to
>> one of their functions?
>
>That's the users responsibility, not one the author of the library should
>concern himself with. If the user passes crap to the library, a crash (or
>at least a SIGSEGV) is what's called for.
>
>The alternative is requiring complete checking of any pointer passed to any
>library, thus penalizing those programs that pass valid pointers for the
>benefit of programmers who can't be bothered to ensure their pointers are
>valid.
>
>That's not the proper way to do it. 

If you don't mind I would prefer not to use libraries you write.

[toc] | [prev] | [next] | [standalone]


#10457

Fromblp@cs.stanford.edu (Ben Pfaff)
Date2011-09-18 16:38 -0700
Message-ID<87d3exxvxq.fsf@blp.benpfaff.org>
In reply to#10455
cri@tiac.net (Richard Harter) writes:

> On Sun, 18 Sep 2011 20:32:12 +0000 (UTC), Kleuskes & Moos
> <kleuske@somewhere.else.net> wrote:
>
>>On Mon, 19 Sep 2011 08:23:50 +1200, Ian Collins wrote:
>>
>>> On 09/19/11 08:00 AM, Kleuskes & Moos wrote:
>>>> On Sun, 18 Sep 2011 19:25:49 +0200, jacob navia wrote:
>>>>
>>>>> You should have a way to avoid crashes because of malicious code that
>>>>> feeds you a bad pointer isn't it?
>>>>
>>>> You should not be uncertain wether or not a pointer is valid or not. If
>>>> you are, your design stinks. If you try to compensate by adding checks,
>>>> your methodology stinks, too.
>>> 
>>> That's untrue.  How can a library designer know what a user will pass to
>>> one of their functions?
>>
>>That's the users responsibility, not one the author of the library should
>>concern himself with. If the user passes crap to the library, a crash (or
>>at least a SIGSEGV) is what's called for.
>>
>>The alternative is requiring complete checking of any pointer passed to any
>>library, thus penalizing those programs that pass valid pointers for the
>>benefit of programmers who can't be bothered to ensure their pointers are
>>valid.
>>
>>That's not the proper way to do it. 
>
> If you don't mind I would prefer not to use libraries you write.

Richard, you seem to believe that a library should validate all
the pointers passed into it.  Can you explain how you believe
that a library should actually do this?  I don't believe that it
is practical.

An example would be helpful.  For example, how would you
implement memcpy()?
-- 
"In My Egotistical Opinion, most people's C programs should be indented six
 feet downward and covered with dirt." -- Blair P. Houghton

[toc] | [prev] | [next] | [standalone]


#10470

Fromcri@tiac.net (Richard Harter)
Date2011-09-19 04:27 +0000
Message-ID<4e76baf8.298487352@text.giganews.com>
In reply to#10457
On Sun, 18 Sep 2011 16:38:57 -0700, blp@cs.stanford.edu (Ben Pfaff)
wrote:

>cri@tiac.net (Richard Harter) writes:
>
>> On Sun, 18 Sep 2011 20:32:12 +0000 (UTC), Kleuskes & Moos
>> <kleuske@somewhere.else.net> wrote:
>>
>>>On Mon, 19 Sep 2011 08:23:50 +1200, Ian Collins wrote:
>>>
>>>> On 09/19/11 08:00 AM, Kleuskes & Moos wrote:
>>>>> On Sun, 18 Sep 2011 19:25:49 +0200, jacob navia wrote:
>>>>>
>>>>>> You should have a way to avoid crashes because of malicious code that
>>>>>> feeds you a bad pointer isn't it?
>>>>>
>>>>> You should not be uncertain wether or not a pointer is valid or not. If
>>>>> you are, your design stinks. If you try to compensate by adding checks,
>>>>> your methodology stinks, too.
>>>> 
>>>> That's untrue.  How can a library designer know what a user will pass to
>>>> one of their functions?
>>>
>>>That's the users responsibility, not one the author of the library should
>>>concern himself with. If the user passes crap to the library, a crash (or
>>>at least a SIGSEGV) is what's called for.
>>>
>>>The alternative is requiring complete checking of any pointer passed to any
>>>library, thus penalizing those programs that pass valid pointers for the
>>>benefit of programmers who can't be bothered to ensure their pointers are
>>>valid.
>>>
>>>That's not the proper way to do it. 
>>
>> If you don't mind I would prefer not to use libraries you write.
>
>Richard, you seem to believe that a library should validate all
>the pointers passed into it.  Can you explain how you believe
>that a library should actually do this?  I don't believe that it
>is practical.
>
>An example would be helpful.  For example, how would you
>implement memcpy()?

Mon ami, you miscomprehend.  I did not claim nor do I suppose that I
can determine whether every pointer is valid.  That is not the issue.
It is the viewpoint.  Let me quote:

    That's the users responsibility, not one the author of the library
    should concern himself with. If the user passes crap to the
    library, a crash (or at least a SIGSEGV) is what's called for.

The issue is:  As a library author do you validate your input as best
you can and provide a graceful response to input error - again as best
as you can?  Or do you, perhaps, take the view that if "the user
passes crap" it is their lookout.

If the library author takes the view that the onus is on the crap
passing user and therefore doesn't have to care whether about
validating input or about designing the library software to be robust.
Given my druthers, I'd rather not use software written by such an
author.

To be fair I believe that K&M is an able programmer who checks inputs
carefully and who writes robust software.  Much of what K&M posts is
of high quality.  However I was dismayed at the attitude expressed in
the post to which I responded.



[toc] | [prev] | [next] | [standalone]


#10472

Fromblp@cs.stanford.edu (Ben Pfaff)
Date2011-09-18 21:48 -0700
Message-ID<878vplxhln.fsf@blp.benpfaff.org>
In reply to#10470
cri@tiac.net (Richard Harter) writes:

> Mon ami, you miscomprehend.  I did not claim nor do I suppose that I
> can determine whether every pointer is valid.  That is not the issue.
> It is the viewpoint.  Let me quote:
>
>     That's the users responsibility, not one the author of the library
>     should concern himself with. If the user passes crap to the
>     library, a crash (or at least a SIGSEGV) is what's called for.
>
> The issue is:  As a library author do you validate your input as best
> you can and provide a graceful response to input error - again as best
> as you can?  Or do you, perhaps, take the view that if "the user
> passes crap" it is their lookout.
>
> If the library author takes the view that the onus is on the crap
> passing user and therefore doesn't have to care whether about
> validating input or about designing the library software to be robust.
> Given my druthers, I'd rather not use software written by such an
> author.

Personally, I believe that the author of a library should
document his assumptions on the input to a library, including the
degree to which the library tolerates deviations.  Usually, I
would rather carefully use a *fast* library that does not verify
its input, instead of a slower library that does.  The former I
can transform into the latter with wrapper functions, if
necessary; the latter I'm stuck with.
-- 
"The expression isn't unclear *at all* and only an expert could actually
 have doubts about it"
--Dan Pop

[toc] | [prev] | [next] | [standalone]


#10475

Fromcri@tiac.net (Richard Harter)
Date2011-09-19 05:38 +0000
Message-ID<4e76d2e5.304613339@text.giganews.com>
In reply to#10472
On Sun, 18 Sep 2011 21:48:36 -0700, blp@cs.stanford.edu (Ben Pfaff)
wrote:

>cri@tiac.net (Richard Harter) writes:
>
>> Mon ami, you miscomprehend.  I did not claim nor do I suppose that I
>> can determine whether every pointer is valid.  That is not the issue.
>> It is the viewpoint.  Let me quote:
>>
>>     That's the users responsibility, not one the author of the library
>>     should concern himself with. If the user passes crap to the
>>     library, a crash (or at least a SIGSEGV) is what's called for.
>>
>> The issue is:  As a library author do you validate your input as best
>> you can and provide a graceful response to input error - again as best
>> as you can?  Or do you, perhaps, take the view that if "the user
>> passes crap" it is their lookout.
>>
>> If the library author takes the view that the onus is on the crap
>> passing user and therefore doesn't have to care whether about
>> validating input or about designing the library software to be robust.
>> Given my druthers, I'd rather not use software written by such an
>> author.
>
>Personally, I believe that the author of a library should
>document his assumptions on the input to a library, including the
>degree to which the library tolerates deviations.  Usually, I
>would rather carefully use a *fast* library that does not verify
>its input, instead of a slower library that does.  The former I
>can transform into the latter with wrapper functions, if
>necessary; the latter I'm stuck with.

Fair enough, if those are your only choices.  Quite often, however,
the cost of verification is insignificant.  Choosing the *fast*
library could be a premature optimization.  Now if I actually had two
libraries that did the same thing *and* I was really really concerned
with speed *and* I did performance measurements on both *and* there a
measurable difference, then I might go with the one that doesn't
verify its inputs.  How often does that happen?

      

[toc] | [prev] | [next] | [standalone]


#10481

Fromjacob navia <jacob@spamsink.net>
Date2011-09-19 09:14 +0200
Message-ID<j56q4f$ljc$1@speranza.aioe.org>
In reply to#10475
Le 19/09/11 07:38, Richard Harter a écrit :
>
> Fair enough, if those are your only choices.  Quite often, however,
> the cost of verification is insignificant.

Exactly

  Choosing the *fast*
> library could be a premature optimization.  Now if I actually had two
> libraries that did the same thing *and* I was really really concerned
> with speed *and* I did performance measurements on both *and* there a
> measurable difference, then I might go with the one that doesn't
> verify its inputs.  How often does that happen?
>

Suppose you mark your data with a 64 bit magic number at the start
of the data structure.

To know if you have a valid pointer you test its validity for
reading 64 bits (8 bytes). If the pointer is valid it takes you
several assignments, 2 calls to signal and 1 call to setjmp.

You can fuse the testing for reading with the reading of the
magic number, so, in fact I would say that at most you are spending
several hundred cycles in testing pointer validty, what in
modern machines is nothing.

If your magic numbers are cleverly built, you can also prevent
the much more common error of passing a valid pointer to a
DIFFERENT kind of object. For instance when writing the serializing
part of the container library I write a GUUID (128 bytes) of
magic number, what allows me to avoid trying to restore a list
container from a file that was actually a saved file from the
vector container!

It can be argued that people that do not make mistakes are
penalized by this, but I think nobody will even notice
that I am reading 128 bytes more and making a memcmp.

[toc] | [prev] | [next] | [standalone]


#10484

From"BartC" <bc@freeuk.com>
Date2011-09-19 10:10 +0100
Message-ID<j570vf$v89$1@dont-email.me>
In reply to#10481
"jacob navia" <jacob@spamsink.net> wrote in message
news:j56q4f$ljc$1@speranza.aioe.org...
> Le 19/09/11 07:38, Richard Harter a écrit :

>  Choosing the *fast*
>> library could be a premature optimization.  Now if I actually had two
>> libraries that did the same thing *and* I was really really concerned
>> with speed *and* I did performance measurements on both *and* there a
>> measurable difference, then I might go with the one that doesn't
>> verify its inputs.  How often does that happen?
>>
>
> Suppose you mark your data with a 64 bit magic number at the start
> of the data structure.

This is impractical for much of the low-level programming that is done in C.

And when the library code is written by someone else, this requires the
caller to maintain the magic number, unless you also insist that
*everything* to do with the data structure is handled by the library.

There is also the risk of stray magic numbers lurking in memory, unless care
is taken in deleting them when no longer needed.

It sounds like something that would be only be suitable for a high-level,
self-contained package such as your Containers thing.

What *would* be nice is libraries checking for NULL pointers, which would 
cause a crash otherwise, as currently happens with many standard functions 
(and requiring me to write wrappers around them to make them better 
behaved).

-- 
Bartc 

[toc] | [prev] | [next] | [standalone]


#10487

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2011-09-19 05:07 -0700
Message-ID<d138d14d-04d4-487c-bffe-bea1c135328e@u19g2000vbm.googlegroups.com>
In reply to#10481
On Sep 19, 10:14 am, jacob navia <ja...@spamsink.net> wrote:
>
> If your magic numbers are cleverly built, you can also prevent
> the much more common error of passing a valid pointer to a
> DIFFERENT kind of object. For instance when writing the serializing
> part of the container library I write a GUUID (128 bytes) of
> magic number, what allows me to avoid trying to restore a list
> container from a file that was actually a saved file from the
> vector container!
>
That's OK now, when terabyte disks are cheap but most datasets are in
the megabyte range.

However it might not always be OK. Terabyte disks are unlikely to
suddenly become expensive again, but datasets could balloon, so your
library is saving many hundreds of millions of lists, or cheaper but
lower capacity storage could come into vogue.

[toc] | [prev] | [next] | [standalone]


#10490

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2011-09-19 14:24 +0100
Message-ID<0.7da8fa584f374ad88928.20110919142408BST.87d3ewvf5z.fsf@bsb.me.uk>
In reply to#10481
jacob navia <jacob@spamsink.net> writes:

> Le 19/09/11 07:38, Richard Harter a écrit :
>>
>> Fair enough, if those are your only choices.  Quite often, however,
>> the cost of verification is insignificant.
>
> Exactly
>
>  Choosing the *fast*
>> library could be a premature optimization.  Now if I actually had two
>> libraries that did the same thing *and* I was really really concerned
>> with speed *and* I did performance measurements on both *and* there a
>> measurable difference, then I might go with the one that doesn't
>> verify its inputs.  How often does that happen?
>>
>
> Suppose you mark your data with a 64 bit magic number at the start
> of the data structure.
>
> To know if you have a valid pointer you test its validity for
> reading 64 bits (8 bytes). If the pointer is valid it takes you
> several assignments, 2 calls to signal and 1 call to setjmp.
>
> You can fuse the testing for reading with the reading of the
> magic number, so, in fact I would say that at most you are spending
> several hundred cycles in testing pointer validty, what in
> modern machines is nothing.
>
> If your magic numbers are cleverly built, you can also prevent
> the much more common error of passing a valid pointer to a
> DIFFERENT kind of object. For instance when writing the serializing
> part of the container library I write a GUUID (128 bytes) of
> magic number, what allows me to avoid trying to restore a list
> container from a file that was actually a saved file from the
> vector container!

If it was a really clever scheme you'd have run-time type checking.  If
the language were really clever, you could do this checking at compile
time.  It's one reason people choose to program in other languages.  I
am not entirely sure why all the people who program in C do so, but some
do so because they want minimal run-time overhead so the case for doing
what amounts to some limited run-time type-checking in C is not clear to
me.  There are languages that do it better, both at compile time and at
run time.  I think you might be aiming at a niche market.

<snip>
-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#10491

Fromjacob navia <jacob@spamsink.net>
Date2011-09-19 16:10 +0200
Message-ID<j57ihc$lv7$1@speranza.aioe.org>
In reply to#10490
Le 19/09/11 15:24, Ben Bacarisse a écrit :
> jacob navia<jacob@spamsink.net>  writes:
>
>> Le 19/09/11 07:38, Richard Harter a écrit :
>>>
>>> Fair enough, if those are your only choices.  Quite often, however,
>>> the cost of verification is insignificant.
>>
>> Exactly
>>
>>   Choosing the *fast*
>>> library could be a premature optimization.  Now if I actually had two
>>> libraries that did the same thing *and* I was really really concerned
>>> with speed *and* I did performance measurements on both *and* there a
>>> measurable difference, then I might go with the one that doesn't
>>> verify its inputs.  How often does that happen?
>>>
>>
>> Suppose you mark your data with a 64 bit magic number at the start
>> of the data structure.
>>
>> To know if you have a valid pointer you test its validity for
>> reading 64 bits (8 bytes). If the pointer is valid it takes you
>> several assignments, 2 calls to signal and 1 call to setjmp.
>>
>> You can fuse the testing for reading with the reading of the
>> magic number, so, in fact I would say that at most you are spending
>> several hundred cycles in testing pointer validty, what in
>> modern machines is nothing.
>>
>> If your magic numbers are cleverly built, you can also prevent
>> the much more common error of passing a valid pointer to a
>> DIFFERENT kind of object. For instance when writing the serializing
>> part of the container library I write a GUUID (128 bytes) of
>> magic number, what allows me to avoid trying to restore a list
>> container from a file that was actually a saved file from the
>> vector container!
>
> If it was a really clever scheme you'd have run-time type checking.

Well, that is run time type checking obviously. But ONLY when you want
and where you want, not everywhere.

> If
> the language were really clever, you could do this checking at compile
> time.

In most cases this is done in C. In most cases this checking is
unnecessary. But for life critical applications it could be worth
to spend some cycles avoiding crashing you see?


> It's one reason people choose to program in other languages.

Look, there are NO languages that will eliminate bugs. There is NO
silver bullet here.

   I
> am not entirely sure why all the people who program in C do so, but some
> do so because they want minimal run-time overhead

Exactly, and the run time overhead of a few pointer verifications at
a critical interface do not change that C is very fast anyway.


> so the case for doing
> what amounts to some limited run-time type-checking in C is not clear to
> me.

There could be a few applications, specially when debugging.


> There are languages that do it better, both at compile time and at
> run time.

No. I think C is quite good.

> I think you might be aiming at a niche market.
>
> <snip>

I am not "aiming" at any market. I am just discussing a function for
checking pointers if needed. I am not selling anything either. We are
so swamped by marketing that in a simple conversation about pointer
checking we need to do a market research first!


Please Ben, let's keep the discussion sane. I proposed a function for
pointer checking in its own rights, because I was surprised that it
could be so simple. Now, is it the panacea for avoiding bugs?

Surely not.

[toc] | [prev] | [next] | [standalone]


#10497

From"BartC" <bc@freeuk.com>
Date2011-09-19 16:50 +0100
Message-ID<j57ocd$lfs$1@dont-email.me>
In reply to#10481
"jacob navia" <jacob@spamsink.net> wrote in message 
news:j56q4f$ljc$1@speranza.aioe.org...

> Suppose you mark your data with a 64 bit magic number at the start
> of the data structure.
>
> To know if you have a valid pointer you test its validity for
> reading 64 bits (8 bytes). If the pointer is valid it takes you
> several assignments, 2 calls to signal and 1 call to setjmp.
>
> You can fuse the testing for reading with the reading of the
> magic number, so, in fact I would say that at most you are spending
> several hundred cycles in testing pointer validty, what in
> modern machines is nothing.

At that level of application, perhaps you can dispense with raw pointers, 
and switch to handles.

A handle could be as simple as an index into a linear table, but the table 
now contains the actual pointer, and any verification necessary, rather than 
sticking magic numbers into user data. And the table itself is in trusted 
memory. This sounds faster than calling some dodgy OS function which may or 
may not work.

But that still won't stop the caller passing a handle B instead of A, both 
equally valid, causing incorrect results if not a crash.

-- 
Bartc 

[toc] | [prev] | [next] | [standalone]


Page 1 of 15  [1] 2 3 … 15  Next page →

Back to top | Article view | comp.lang.c


csiph-web