Menu

#333 Insufficient memory allocation in posix vos_semaCreate

2.0.3.0
closed
None
2020-08-21
2020-05-06
No

In posix vos_semaCreate following line allocates memory:
*ppSema = (VOS_SEMA_T) vos_memAlloc(sizeof (VOS_SEMA_T));

which is passed to sem_init few lines later. The allocation allocates only for a size of pointer, but sem_init expects to get a pointer to an already allocated sem_t. I noticed this while investigating a crash with valgrind. I believe same problem may also be in the Windows implementation. I've attached a patch that should fix the problem for posix.

I'm using version 1.3.3.0 but the same code is also present in the trunk and the patch is based on the trunk.

1 Attachments

Discussion

  • Bernd Löhr

    Bernd Löhr - 2020-07-17
    • status: open --> accepted
    • assigned_to: Bernd Löhr
    • Milestone: 2.1.0.0 --> 2.0.3.0
     
  • Bernd Löhr

    Bernd Löhr - 2020-07-17

    This is very strange. Actually there is no definition of struct VOS_SEM in the POSIX part at all. It all works as long as the Semaphore has the size ≤ sizeof(ptr).

     
  • Bernd Löhr

    Bernd Löhr - 2020-07-30
    • status: accepted --> pending
     
  • Bernd Löhr

    Bernd Löhr - 2020-08-21
    • Status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB