Skip to content

Conversation

@olomix
Copy link
Collaborator

@olomix olomix commented Oct 16, 2025

No description provided.

…rors

Add PROVER_ERROR_INSUFFICIENT_BUFFER to distinguish between buffer size
failures that occur before vs after proof generation:

- PROVER_ERROR_SHORT_BUFFER: Buffer smaller than minimum size, checked
  before calling the expensive prove() operation. Allows early return
  without wasting computation.

- PROVER_ERROR_INSUFFICIENT_BUFFER: Buffer smaller than actual proof
  output size, checked after prove() completes. Occurs when proof size
  exceeds the minimum estimate.

This two-phase validation prevents unnecessary proof generation when
buffers are obviously too small, while handling edge cases where the
actual proof exceeds minimum size estimates.

Additional improvements:
- Add CopyErrorFmt() for safe variadic error formatting
- Fix error messages to show original (not updated) buffer sizes
- Add overflow protection for buffer size calculations
- Replace strncpy with memcpy for explicit string handling
- Remove unused ShortBufferException and CheckAndUpdateBufferSizes
- Document buffer size semantics (output excludes null terminator)
- Fix CopyError to guarantee null-termination with snprintf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants