Re: how to test this piece of C code



subramanian100in@xxxxxxxxx, India said:

<snip>

if (curSize > SIZE_MAX - blockSize)

Replace this code with:

if (curSize > MAX_BLOCK_LENGTH - blockSize)

and #define MAX_BLOCK_LENGTH in a header somewhere. For one thing, you
probably don't want it to be SIZE_MAX anyway (although, if you do, you
can define it as such in your header), and for another thing, it means
you can easily tweak it down to more easily tested values when need be
without having to hack at your source code each time.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.



Relevant Pages

  • Re: how to test this piece of C code
    ... can define it as such in your header), and for another thing, it means ... you can easily tweak it down to more easily tested values when need be ... there any specific reason for using #define here? ...
    (comp.programming)
  • Re: if-modified-since question (protocol problem?)
    ... request, but in response you are interested only if your request ... To base the decision on whether there is something 'new to show' would require knowledge about something 'old' - a cached resource. ... No Last-Modified header is sent in the response, ...
    (comp.infosystems.www.authoring.html)
  • Re: using document.createElementNS or document.createElement
    ... 'looking at' the Accept header certainly isn't as simple as a substring match. ... It's in this latter area that content negotiation mechanisms seem to commit their worst offences. ... As there is no quality value associated with the media range at the end of the list, it means that everything is acceptable; only the explicitly listed types have a higher preference. ...
    (comp.lang.javascript)
  • Re: How to diagnose sendmail failure to some addresses?
    ... There will be a way for the sender to learn about the occurrence of and reason for a message failure if the mail handlers involved in the failure are configured in a traditional standards-compliant and robust manner and if the message is well-formed and sent using header and envelope addresses that provide a deliverable return path for error messages. ... header on the deliverdd mail. ...
    (comp.mail.sendmail)
  • Re: resuming swsusp twice
    ... it should only be an error message, ... the console was left on the swsusp VT ... [snip severe ext3 damage] ... it would verify that the header and the image matched, ...
    (Linux-Kernel)