[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pdf-devel] PDF_FORCE_BIGNUM
From: |
Jeffrey Walton |
Subject: |
Re: [pdf-devel] PDF_FORCE_BIGNUM |
Date: |
Sat, 6 Feb 2010 19:18:40 -0500 |
Hi Jose,
> Its not enough to '#define PDF_FORCE_BIGNUMS' in types.h (apparently,
> some modules do not treat pdf_i64_t opaquely, or do not honor
> PDF_USE_BUILTIN_64BIT_SUPPORT).
>
> Which modules are those? We definitely want to fix that.
I think this one is now tracked down. pdf-time.c would crash on
occasion (depending on how I nudged things). I was able to get it to
crash using both built in int64_t and BIGNUM. The first issue appeared
in pdf_time_clear when the pdf_i64_assign_quick was invoked. Once
things got unstable, lots of seg faults followed. pdf_time_clear was
trying to zero out a pdf_i64_t.
I found by adding a true function, pdf_i64_zero() cleared the issue.
I've got too many changes to types.h/types.c (and so little knowledge
of bzr) that I can't offer a patch. Fortunately, the changes were
small so the code is below.
Jeff
// pdf-time.c
/* Clear contents of the pdf_time_t object */
pdf_status_t
pdf_time_clear (pdf_time_t time_var)
{
PDF_ASSERT_BASE (NULL != time_var);
if (NULL == time_var)
{
return PDF_ERROR;
}
pdf_status_t status = PDF_OK;
/* Set time as January 1st, 1970 */
status = pdf_i64_zero (&(time_var->seconds));
PDF_ASSERT_BASE (status == PDF_OK);
/* UTC */
time_var->gmt_offset = 0;
return status;
}
// pdf-type.h
INLINE pdf_status_t pdf_i64_zero (pdf_i64_t* bignum);
// pdf-types.h
INLINE pdf_status_t
pdf_i64_zero (pdf_i64_t * bignum)
{
PDF_ASSERT_BASE (NULL != bignum);
if (NULL == bignum)
{
return PDF_ERROR;
}
#if defined(PDF_USE_BUILTIN_64BIT_SUPPORT)
*bignum = 0;
#else
bignum->high = 0;
bignum->low = 0;
#endif
return PDF_OK;
}
On Thu, Feb 4, 2010 at 1:26 PM, <address@hidden> wrote:
>
> Hi Jeff.
>
> In config.h near line 790, there's the following comment:
>
> /* Force the usage of the 64bits bignum implementation even if the system
> support a suitable native type */
> /* #undef PDF_FORCE_BIGNUMS */
>
> [SNIP]