Skip to content

Conversation

@cmcfarlen
Copy link
Contributor

This PR will fail a cache read if the content-length in the cached response header does not match the cached object size.

} else {
f.single_fragment = false;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be checked when selecting alternates, but then it wouldn't get cleaned up as well.

}

// Now that we have selected an alternate, validate that the content length and object size match
MIMEField *field = alternate.response_get()->field_find(MIME_FIELD_CONTENT_LENGTH, MIME_LEN_CONTENT_LENGTH);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few style things -

if ( auto field = alternate.response_get()->field_find(MIIME_FIELD_CONTENT_LENGTH, MIME_LEN_CONTENT_LENGTH) ; field ) {
  if ( auto cl = static_cast<uint64_t>(field->value_get_int64()) ; cl != doc_len) {
    // ...
  }
}

@bryancall bryancall merged commit db10890 into apache:master Aug 15, 2022
@cmcfarlen cmcfarlen deleted the doc_corrupt branch August 15, 2022 23:27
zwoop pushed a commit that referenced this pull request Aug 23, 2022
…#8976)

Co-authored-by: Vijay Mamidi <vijayabhaskar_mamidi@yahoo.com>
(cherry picked from commit db10890)
@zwoop
Copy link
Contributor

zwoop commented Aug 23, 2022

Cherry-picked to v9.2.x

@zwoop zwoop modified the milestones: 10.0.0, 9.2.0 Aug 23, 2022
cmcfarlen added a commit to cmcfarlen/trafficserver that referenced this pull request Aug 23, 2022
…apache#8976)

Co-authored-by: Vijay Mamidi <vijayabhaskar_mamidi@yahoo.com>
@zwoop zwoop modified the milestones: 9.2.0, 10.0.0 Aug 23, 2022
masaori335 pushed a commit to masaori335/trafficserver that referenced this pull request Feb 21, 2023
* asf/9.2.x:
  Updated ChangeLog
  utilize proxy.config.hostdb.host_file.interval config variable (apache#9039)
  Remove plugin parent_select unused symbols (apache#9023)
  Require use of 'override' keyword when valid. (apache#8737)
  Fix compile error on macOS (apache#9047)
  Validate that content length header matches object size on cache read (apache#8976)
  Fix reload memory leak (apache#9041)
  Update prepare_proxy_verifier.sh to work in non-git directories (apache#9048)
  Change linux/fs include to build with glibc 2.36 (apache#9027)
  ts::shared_mutex - Fix lock counting for debug (apache#9040)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants