Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005632 [Resin] major always 01-14-14 08:45 09-08-14 17:08
Reporter bean View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.41 Product Version 4.0.38
  Product Build
Summary 0005632: calculate_poll_result() returns uninitialized value
Description In std.c, calculate_poll_result() is supposed to return an int value. But it has a path that doesn't return anything. In that case, the caller gets a bogus return value.

This is especially dangerous as this becomes the return value from std_read()

Steps To Reproduce
Additional Information ---------------------
Here is the bad method:
---------------------

static int
calculate_poll_result(connection_t *conn, int poll_result)
{
  if (poll_result == 0) {
    return TIMEOUT_EXN;
  }
  else if (poll_result < 0 && errno != EINTR) {
    return read_exception_status(conn, errno);
  }
  /* missing return here */
}
Attached Files

- Relationships

- Notes
(0006390)
bean
01-16-14 08:26

Because read_exception_status() already deals with each errno value, this might be a reasonable fix:

static int
calculate_poll_result(connection_t *conn, int poll_result)
{
  if (poll_result == 0) {
    return TIMEOUT_EXN;
  } else {
    return read_exception_status(conn, errno);
  }
}
 

- Issue History
Date Modified Username Field Change
01-14-14 08:45 bean New Issue
01-16-14 08:26 bean Note Added: 0006390
01-16-14 08:37 bean Issue Monitored: bean
09-08-14 17:08 ferg Assigned To  => ferg
09-08-14 17:08 ferg Status new => closed
09-08-14 17:08 ferg Resolution open => fixed
09-08-14 17:08 ferg Fixed in Version  => 4.0.41
09-08-14 17:08 ferg Additional Information Updated


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker