[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2397) hilo generator can generate negative numbers because of arithmetic overflow

Peter Severin (JIRA) noreply at atlassian.com
Tue Feb 27 13:49:31 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2397?page=comments#action_26332 ] 

Peter Severin commented on HHH-2397:
------------------------------------

This is clearly a bug. Instead of generating long, 64-bits ids this implementation always generates ints on 32-bits. Potentially this bug can cause serious problems on large databases.

> hilo generator can generate negative numbers because of arithmetic overflow
> ---------------------------------------------------------------------------
>
>          Key: HHH-2397
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2397
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Reporter: Steve Ebersole
>     Assignee: Steve Ebersole
>      Fix For: 3.2.3

>
>
> org.hibernate.id.TableHiLoGenerator#generate can potentially generate negative numbers because of the possibility of overflow due to the handling of the "clock over" multiplication using int multiplication.  The solution is to force one of the operands to type long.

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




More information about the hibernate-issues mailing list